How to change Tensor’s type in CPP?
In Pytorch, we can do that.
import torch
a = torch.randn(10) # a.dtype -> torch.float32
b = a.type(torch.int32); # b.dtype -> torch.int32
But how to change the type in CPP?
torch::Tensor data; // torch.float32
data.type(torch::kInt32); // error: no matching function for call to "at::Tensor::type ..."
please help me, thanks a lot.