1 | #pragma once |
2 | |
3 | #include <ATen/core/Tensor.h> |
4 | #include <torch/csrc/python_headers.h> |
5 | |
6 | namespace torch { |
7 | namespace utils { |
8 | |
9 | PyObject* tensor_to_numpy(const at::Tensor& tensor, bool force = false); |
10 | at::Tensor tensor_from_numpy(PyObject* obj, bool warn_if_not_writeable = true); |
11 | |
12 | int aten_to_numpy_dtype(const at::ScalarType scalar_type); |
13 | at::ScalarType numpy_dtype_to_aten(int dtype); |
14 | |
15 | bool is_numpy_available(); |
16 | bool is_numpy_int(PyObject* obj); |
17 | bool is_numpy_scalar(PyObject* obj); |
18 | |
19 | void warn_numpy_not_writeable(); |
20 | at::Tensor tensor_from_cuda_array_interface(PyObject* obj); |
21 | |
22 | void validate_numpy_for_dlpack_deleter_bug(); |
23 | bool is_numpy_dlpack_deleter_bugged(); |
24 | |
25 | } // namespace utils |
26 | } // namespace torch |
27 | |