报错# ValueError: only one element tensors can be converted to Python scalars
在dataloader进行保存图片时报错ValueError: only one element tensors can be converted to Python scalars
原文代码如下
ValueError:只有一个元素张量可以转换为Python标量,转换错误了
使用 numpy () 方法来将张量转换为 numpy 数组,然后再使用 item () 方法来获取数组中的某个元素