RuntimeError: Expected object of scalar type Long but got scalar type Float for argument #2 'target'

在用pytorch进行深度神经网络训练时,出现以下问题,特做记录 这个错误是说需要的数据类型是long而我的数据类型是float,所以需要进行数据类型转化 在pytorch中数据转化有专属自己的用法,即data=data.long() 所以在代码中做了如下修改: cond_op_truth_var = cond_op_truth_var.long() 问题解决
相关文章
相关标签/搜索