Skip to content

Commit 75b24c2

Browse files
shinkpytorchmergebot
authored andcommitted
Export torch::utils::tensor_to_numpy (pytorch#154178)
Fixes pytorch#154105 Pull Request resolved: pytorch#154178 Approved by: https://github.com/albanD, https://github.com/Skylion007, https://github.com/youkaichao
1 parent 7b07434 commit 75b24c2

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

torch/csrc/utils/tensor_numpy.h

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,21 @@
55

66
namespace torch::utils {
77

8-
PyObject* tensor_to_numpy(const at::Tensor& tensor, bool force = false);
9-
at::Tensor tensor_from_numpy(PyObject* obj, bool warn_if_not_writeable = true);
8+
TORCH_API PyObject* tensor_to_numpy(
9+
const at::Tensor& tensor,
10+
bool force = false);
1011

11-
int aten_to_numpy_dtype(const at::ScalarType scalar_type);
12-
at::ScalarType numpy_dtype_to_aten(int dtype);
12+
TORCH_API at::Tensor tensor_from_numpy(
13+
PyObject* obj,
14+
bool warn_if_not_writeable = true);
1315

14-
bool is_numpy_available();
15-
bool is_numpy_int(PyObject* obj);
16-
bool is_numpy_bool(PyObject* obj);
17-
bool is_numpy_scalar(PyObject* obj);
16+
TORCH_API int aten_to_numpy_dtype(const at::ScalarType scalar_type);
17+
TORCH_API at::ScalarType numpy_dtype_to_aten(int dtype);
18+
19+
TORCH_API bool is_numpy_available();
20+
TORCH_API bool is_numpy_int(PyObject* obj);
21+
TORCH_API bool is_numpy_bool(PyObject* obj);
22+
TORCH_API bool is_numpy_scalar(PyObject* obj);
1823

1924
void warn_numpy_not_writeable();
2025
at::Tensor tensor_from_cuda_array_interface(PyObject* obj);

0 commit comments

Comments
 (0)