Pytorch math calculation ( only one element tensors can be converted to Python scalars)
What does it mean by only one element tensors can be converted to Python scalars in this case and how do I suppose to debug it?
x1 = (max-min)*torch.rand(1, 21) + min
x2 = (max-min)*torch.rand(1, 21) + min
zipped_list = zip(x1, x2)
y = [math.sin(2*x1+2) * math.cos(0.5*x2)+0.5 for (x1, x2) in zipped_list]

output
ValueError: only one element tensors can be converted to Python scalars


problem is because of using math.cos and math.sin. math.cos isn't vectorized, but np.cos is. use np.sin and np.cos or torch.sinand torch.cos.
