| 527 | |
| 528 | template <typename Backend> |
| 529 | py::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 | |
| 548 | template <typename Backend> |
| 549 | DLDevice GetDLDevice(const Tensor<Backend> &tensor) { |
nothing calls this directly
no test coverage detected