Hi,
I’m loading a model trained in python via torchscript to C++.
I’m doing it according to the tutorial: https://pytorch.org/tutorials/advanced/cpp_export.html
I have a network operating with CUDA.
I’m transforming the input tensor from a vector via tensor::from_blob (data is a vector containing all values of a matrix) :
torch::Device device(at::kCUDA);
inputs.push_back(torch::from_blob(data.data(), {375,375}, device));
I get this error:
terminate called after throwing an instance of ‘c10::Error’
what(): CUDA error: invalid argument (getDeviceFromPtr at …/…/aten/src/ATen/cuda/CUDADevice.h:13)
i don’t know what to do, if I set the input to torch::ones everything works fine:
torch::Device device(at::kCUDA);
inputs.push_back(torch::ones({375, 375}, device));
(no error)
Thank you