AttributeError: ‘torch.dtype’ object has no attribute ‘type’
np.mean() can be changed to torch.mean(torch.stack(my_list))
loss is a tensor.
np.mean() can input list or array
. torch.mean() must input tensor, and the final result is also tensor.
torch.stack() stacks data along a certain dimension
, so np.mean() will report an error