Skip to content

Commit

Permalink
Add documentation to _check_gpu2cpu.
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
  • Loading branch information
mzient committed Oct 1, 2024
1 parent 9431cdc commit b3525db
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dali/python/nvidia/dali/data_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,16 @@ def source_info(self, *, device="cpu"):
return self.property("source_info", device=device)

def _check_gpu2cpu(self):
"""Checks whether using this `DataNode` in a CPU operator is legal.
The function checks whether it's legal to pass it as an input to a CPU operator.
If the node is a result of a GPU operator which belongs to a pipeline with non-dynamic
executor, an error is raised.
.. note::
If the defining operator does not yet belong to any pipeline, the error is not raised and
the check is deferred until `Pipeline.build`.
"""
if self.device == "gpu" and self.source and self.source.pipeline:
if not self.source.pipeline._exec_dynamic:
raise RuntimeError(
Expand Down

0 comments on commit b3525db

Please sign in to comment.