pytorch运行时预报报错:
RuntimeError: mean(): input dtype should be either floating point or complex dtypes. Got Long instead.
运行代码如下:
A=torch.arange(20,dtype=torch.float32).reshape(5,4)
A.mean(),A.sum()/A.numel()
报错如下:
修改方法:将axia=0,修改为dim=0
参考文章: