Returns the run-time shapes of this DataNode as a new DataNode Parameters ---------- arg_dtype : DALIDataType, optional If specified, the shape will be converted to this data type; defaults to INT64. device : str, optional The device ("cpu" or
(self, *, dtype=None, device="cpu")
| 315 | return nvidia.dali.fn.expand_dims(sliced, axes=new_axes, new_axis_names=new_axis_names) |
| 316 | |
| 317 | def shape(self, *, dtype=None, device="cpu"): |
| 318 | """Returns the run-time shapes of this DataNode as a new DataNode |
| 319 | |
| 320 | Parameters |
| 321 | ---------- |
| 322 | arg_dtype : DALIDataType, optional |
| 323 | If specified, the shape will be converted to this data type; defaults to INT64. |
| 324 | device : str, optional |
| 325 | The device ("cpu" or "gpu") where the result is returned; defaults to CPU. |
| 326 | """ |
| 327 | from . import fn |
| 328 | |
| 329 | if device == "cpu": |
| 330 | self._check_gpu2cpu() |
| 331 | return fn._shape(self, dtype=dtype, device=device) |
| 332 | |
| 333 | def property(self, key, *, device="cpu"): |
| 334 | """Returns a metadata property associated with a DataNode |