-
Notifications
You must be signed in to change notification settings - Fork 622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add .as_cpu() to TensorCPU and TensorListCPU #5751
base: main
Are you sure you want to change the base?
Conversation
!build |
CI MESSAGE: [21514315]: BUILD STARTED |
dali/python/backend_impl.cc
Outdated
@@ -1174,6 +1179,10 @@ void ExposeTensorList(py::module &m) { | |||
Returns a `TensorListGPU` object being a copy of this `TensorListCPU`. | |||
)code", | |||
py::return_value_policy::take_ownership) | |||
.def("as_cpu", [](TensorList<CPUBackend> &t) { | |||
return t; | |||
}, R"code(Bypass, as it is already an instance of `TensorListCPU`.)code", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}, R"code(Bypass, as it is already an instance of `TensorListCPU`.)code", | |
}, R"code(No-op, as it is already an instance of `TensorListCPU`.)code", |
CI MESSAGE: [21514315]: BUILD FAILED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to adjust the .pyi file as well: #5153 https://github.com/NVIDIA/DALI/blob/main/dali/python/nvidia/dali/tensors.pyi
3c5ca4e
to
5e67bc7
Compare
CI MESSAGE: [21515824]: BUILD STARTED |
5e67bc7
to
8bf8ccb
Compare
Done |
8bf8ccb
to
9eea449
Compare
CI MESSAGE: [21515880]: BUILD STARTED |
CI MESSAGE: [21515880]: BUILD FAILED |
9eea449
to
4bf2fc6
Compare
CI MESSAGE: [21518436]: BUILD STARTED |
CI MESSAGE: [21518436]: BUILD FAILED |
4bf2fc6
to
2409853
Compare
CI MESSAGE: [21574166]: BUILD STARTED |
CI MESSAGE: [21574166]: BUILD FAILED |
dali/python/backend_impl.cc
Outdated
@@ -1174,6 +1179,10 @@ void ExposeTensorList(py::module &m) { | |||
Returns a `TensorListGPU` object being a copy of this `TensorListCPU`. | |||
)code", | |||
py::return_value_policy::take_ownership) | |||
.def("as_cpu", [](TensorList<CPUBackend> &t) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.def("as_cpu", [](TensorList<CPUBackend> &t) { | |
.def("as_cpu", [](TensorList<CPUBackend> &t) -> TensorList<CPUBackend> & { |
CI MESSAGE: [21612243]: BUILD STARTED |
CI MESSAGE: [21612243]: BUILD FAILED |
CI MESSAGE: [21648900]: BUILD STARTED |
be087a6
to
ce3b3f7
Compare
ce3b3f7
to
f98babf
Compare
CI MESSAGE: [21650689]: BUILD STARTED |
f98babf
to
1a2a67c
Compare
CI MESSAGE: [21650844]: BUILD STARTED |
1a2a67c
to
d3c687d
Compare
CI MESSAGE: [21678033]: BUILD STARTED |
d3c687d
to
55b6004
Compare
CI MESSAGE: [21678984]: BUILD STARTED |
CI MESSAGE: [21678984]: BUILD FAILED |
Signed-off-by: Joaquin Anton Guirao <[email protected]>
Signed-off-by: Joaquin Anton Guirao <[email protected]>
Signed-off-by: Joaquin Anton Guirao <[email protected]>
55b6004
to
4867508
Compare
CI MESSAGE: [21783114]: BUILD STARTED |
CI MESSAGE: [21783114]: BUILD FAILED |
CI MESSAGE: [21815118]: BUILD STARTED |
4c77bd1
to
0456bfe
Compare
CI MESSAGE: [21815175]: BUILD STARTED |
0456bfe
to
4449330
Compare
CI MESSAGE: [21819424]: BUILD STARTED |
4449330
to
93248e8
Compare
Signed-off-by: Joaquin Anton Guirao <[email protected]>
93248e8
to
eca2d2c
Compare
CI MESSAGE: [21823142]: BUILD STARTED |
CI MESSAGE: [21815175]: BUILD FAILED |
CI MESSAGE: [21823142]: BUILD FAILED |
Category:
New feature
Description:
Adds a new API .as_cpu() to TensorCPU and TensorListCPU classes, similar to the one in TensorGPU and TensorListGPU.
This simplifies writing generic code that can take both CPU or GPU tensors.
For CPU, it is a bypass operation
Additional information:
Affected modules and functionalities:
TensorCPU and TensorListCPU
Key points relevant for the review:
Tests:
Checklist
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: N/A