welcome to my blog
问题描述: 执行torch.exp(torch.tensor([2]))
报错, RuntimeError: exp_vml_cpu not implemented for ‘Long’
原因: torch.exp()操作不支持Long类型的张量作为输入
解决方法: 将张量转为浮点型即可, 执行torch.exp(torch.tensor([2.0]))
或者执行torch.exp(torch.tensor([2],dtype=torch.float))
总结: pytorch中的很多操作不支持Long类型的张量, 所以会出现这一类报错信息:RuntimeError: xxx_vml_cpu not implemented for ‘Long’, 只需要把输入的张量改成浮点类型即可