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