@@ -16,14 +16,16 @@ inline void bind(py::module &m) {
1616 .def_property_readonly (" ndim" , [](const Tensor &tensor) { return tensor->ndim (); })
1717 .def_property_readonly (" dtype" , [](const Tensor &tensor) { return tensor->dtype (); })
1818
19- .def (" data_ptr" , [](const Tensor &tensor) { return tensor->data (); })
19+ .def (" data_ptr" , [](const Tensor &tensor) { return reinterpret_cast < uintptr_t >( tensor->data () ); })
2020 .def (" size" , [](const Tensor &tensor, std::size_t dim) { return tensor->size (dim); })
2121 .def (" stride" , [](const Tensor &tensor, std::size_t dim) { return tensor->stride (dim); })
2222 .def (" numel" , [](const Tensor &tensor) { return tensor->numel (); })
2323
2424 .def (" is_contiguous" , [](const Tensor &tensor) { return tensor->is_contiguous (); })
2525 .def (" is_pinned" , [](const Tensor &tensor) { return tensor->is_pinned (); })
2626 .def (" info" , [](const Tensor &tensor) { return tensor->info (); })
27+ .def (" debug" , [](const Tensor &tensor) { return tensor->debug (); })
28+ .def (" debug" , [](const Tensor &tensor, const std::string &filename) { return tensor->debug (filename); })
2729
2830 .def (" copy_" , [](Tensor &tensor, const Tensor &other) { tensor->copy_from (other); })
2931 .def (" to" , [](const Tensor &tensor, const Device &device) { return tensor->to (device); })
@@ -49,7 +51,8 @@ inline void bind(py::module &m) {
4951 py::arg (" device" ),
5052 py::arg (" pin_memory" ) = false );
5153
52- m.def (" from_blob" , [](uintptr_t raw_ptr, Shape &shape, const DataType &dtype, const Device &device) { return Tensor{infinicore::Tensor::from_blob (reinterpret_cast <void *>(raw_ptr), shape, dtype, device)}; }, pybind11::arg (" raw_ptr" ), pybind11::arg (" shape" ), pybind11::arg (" dtype" ), pybind11::arg (" device" ));
54+ m.def (
55+ " from_blob" , [](uintptr_t raw_ptr, Shape &shape, const DataType &dtype, const Device &device) { return Tensor{infinicore::Tensor::from_blob (reinterpret_cast <void *>(raw_ptr), shape, dtype, device)}; }, pybind11::arg (" raw_ptr" ), pybind11::arg (" shape" ), pybind11::arg (" dtype" ), pybind11::arg (" device" ));
5356}
5457
5558} // namespace infinicore::tensor
0 commit comments