解决pytorch报错RuntimeError: exp_vml_cpu not implemented for 'Byte’问题:
在调试代码过程中遇到报错:
RuntimeError: exp_vml_cpu not implemented for 'Byte'
通过提示可知,报错是因为exp_vml_cpu 不能用于Byte类型计算,这里通过 .dtype 来查看要运算的tensor类型:
print(outputs.dtype)
输出:
torch.uint8
而在计算中,默认采用 torch.float32 进行计算,因此需要将tensor类型进行变换。py