- nn.MSEloss()
(1) RuntimeError: Boolean value of Tensor with more than one value is ambiguous
loss函数使用前必须进行实例化
(2) RuntimeError: Found dtype Double but expected Float
target需要从double转换为float类型
方法:
target.to(torch.float32)
- r2(target, pred)
(1) TypeError: can’t convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
先把pred和target转到cpu上,.cpu(); 再从计算图中剥离下来 .detach(), 再转成numpy
pred = pred.cpu().detach().numpy()
-
‘SVR’ object has no attribute ‘predict_proba’
sklearn 没有学好啊
.predict() 是用来回归的,得到的是点值
.predict_proba 明显,是预测的概率值 -
Process finished with exit code -1073740791 (0xC0000409)
原因:cudnn没有装好
解决:https://blog.csdn.net/qq_40418553/article/details/125662221



