I am getting the following error using from_blob. I just want to initiate a tensor with fixed values on GPU. How can I do it?
float _x[4] = {0.5,-1.2,3.4,2.2};
torch::Tensor x = torch::from_blob(_x, {4}).clone().to(torch::kCUDA);
But I end up receiving the following error
IndexError: select(): index 4 out of range for tensor of size [4] at dimension 0
I have also tried using this method to create a tensor on the GPU.
auto options = torch::TensorOptions().device(torch::kCUDA,0);```