Hi, I am working on a project which need transfer the Pytorch tensor to libtorch and vice versa.
I already knew that it may need following functions :
PyObject * THPVariable_Wrap(at::Tensor t);
at::Tensor& THPVariable_Unpack(PyObject* obj);
However, I tried use them like these:
void receive_tensor_from_py(PyObject* obj){
at::Tensor &t = THPVariable_Unpack(obj);
std::cout << &t << std::endl;
}
But it doesn’t work, can anyone gives a small sample code?