Fix missing symbol issue when USE_NUMPY=False (#81967)

Fixes missing symbol issue if torch is built with USE_NUMPY=False.

- `tensor_to_numpy` signature changed.
- `warn_numpy_not_writeable` missed.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/81967
Approved by: https://github.com/ezyang
This commit is contained in:
Lu, Chengjun
2022-07-22 13:57:50 +00:00
committed by PyTorch MergeBot
parent 6e9b0dcdc4
commit 008bff1e03

View File

@ -7,7 +7,7 @@
#ifndef USE_NUMPY
namespace torch {
namespace utils {
PyObject* tensor_to_numpy(const at::Tensor& tensor) {
PyObject* tensor_to_numpy(const at::Tensor&, bool) {
throw std::runtime_error("PyTorch was compiled without NumPy support");
}
at::Tensor tensor_from_numpy(
@ -29,6 +29,10 @@ bool is_numpy_scalar(PyObject* obj) {
at::Tensor tensor_from_cuda_array_interface(PyObject* obj) {
throw std::runtime_error("PyTorch was compiled without NumPy support");
}
void warn_numpy_not_writeable() {
throw std::runtime_error("PyTorch was compiled without NumPy support");
}
} // namespace utils
} // namespace torch
#else