diff --git a/python_binding/data/pybind_Tensor.cpp b/python_binding/data/pybind_Tensor.cpp index 7e29cbb04f63bf99d86f63004dfede452a7a8ce0..fe606cfb557042d581e09da7419d80841d1dc2d4 100644 --- a/python_binding/data/pybind_Tensor.cpp +++ b/python_binding/data/pybind_Tensor.cpp @@ -315,6 +315,7 @@ void init_Tensor(py::module& m){ .def(py::self - py::self) .def(py::self * py::self) .def(py::self / py::self) + .def("clone", &Tensor::clone) .def("sqrt", &Tensor::sqrt) .def("set_datatype", &Tensor::setDataType, py::arg("datatype"), py::arg("copyCast") = true) .def("set_backend", &Tensor::setBackend, py::arg("name"), py::arg("device") = 0, py::arg("copyFrom") = true) @@ -334,8 +335,8 @@ void init_Tensor(py::module& m){ .def("cpy_transpose", (void (Tensor::*)(const Tensor& src, const std::vector<DimSize_t>& transpose)) &Tensor::copyTranspose, py::arg("src"), py::arg("transpose")) .def("__str__", [](Tensor& b) { - if (b.empty()) { - return std::string("{}"); + if (b.empty() && b.undefined()) { + return std::string("{}"); } else { return b.toString(); }