RuntimeError: Integer division of tensors using div or / is no longer supported, and in a future rel
程序员文章站
2022-03-04 14:09:39
...
RuntimeError: Integer division of tensors using div or / is no longer supported, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead.
在高版本的pytorch中,会报这个错误。
例子:
norm_img = transforms.Normalize((10,10,10), (1,1,1))(img)为1
print(norm_img)
报上面错误
解决方案:
对数据进行规范化处理
img=img.float() #加这一行
norm_img = transforms.Normalize((10,10,10), (1,1,1))(img)
print(norm_img)
上一篇: html是什么的缩写
下一篇: php变量与json格式数据相互转换
推荐阅读
-
【pytorch】RuntimeError: Integer division of tensors using div or / is no longer supported
-
【pytorch】RuntimeError: Integer division of tensors using div or / is no longer supported【解决】
-
【pytorch】【解决】RuntimeError: Integer division of tensors using div or / is no longer supported
-
RuntimeError: Integer division of tensors using div or / is no longer supported, and in a future rel
-
RuntimeError: Integer division of tensors using div or / is no longer supported, and in a future rel