MCPcopy Create free account
hub / github.com/NVIDIA/DALI / GetTensorProperty

Function GetTensorProperty

dali/python/backend_impl.cc:529–546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

527
528template <typename Backend>
529py::object GetTensorProperty(const Tensor<Backend> &tensor, std::string name) {
530 if (name == "layout") {
531 TensorLayout layout = tensor.GetLayout();
532 if (layout.empty())
533 return py::none();
534 else
535 return py::str(layout.c_str());
536 } else if (name == "source_info") {
537 auto &&srcinfo = tensor.GetSourceInfo();
538 if (srcinfo.empty())
539 return py::none();
540 else
541 return py::str(srcinfo);
542 } else {
543 // TODO(michalz): Make TensorMeta more flexible and have some dictionary
544 return py::none();
545 }
546}
547
548template <typename Backend>
549DLDevice GetDLDevice(const Tensor<Backend> &tensor) {

Callers

nothing calls this directly

Calls 4

GetLayoutMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45
GetSourceInfoMethod · 0.45

Tested by

no test coverage detected