运行时错误: expecteddtypedoublebutgotdtypefloat (validate _ dtype at .atensrcatennative TensorIterator.cpp:143 () no backtrace available ) pytorch培训网络错误位于loss.backward )语句中,如上所述,导入语句
torch.set _ default _ tensor _ type (torch.double tensor )添加上述语句时,将出现以下新错误:
运行时错误:输入类型(torch.cuda.float tensor ) andweighttype ) torch.cuda.doubletensor ) should be the same,因此
source _ data=source _ data.type (torch.double tensor ) source_data=source_data.cuda )现在程序可以正常运行,并且
参考:
1.https://blog.csdn.net/gulaixaingjuejue/article/details/108592941
2.https://blog.csdn.net/jizhidexiaoming/article/details/82502280