【无标题】

Pytorch error记录

  1. 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)

  1. 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()

  1. ‘SVR’ object has no attribute ‘predict_proba’
    sklearn 没有学好啊
    .predict() 是用来回归的,得到的是点值
    .predict_proba 明显,是预测的概率值

  2. Process finished with exit code -1073740791 (0xC0000409)
    原因:cudnn没有装好
    解决:https://blog.csdn.net/qq_40418553/article/details/125662221

5._pickle.PicklingError: Can’t pickle <class ‘main.ANN’>: attribute lookup ANN on main failed
torch.save 保存模型时出问题, 把模型定义和训练文件分开写,一个model.py, 一个train.py

6.TypeError: can’t convert np.ndarray of type numpy.object_. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint8, and bool.
一种问题是数据shape不一致
我的问题是,在一个ndarray里面存了多个ndarray,在append进list的时候就转成ndarray装进去,
list.append(np.array().astype(np.float64))
存到DataFrame之后取出来用的时候,不要用.to_numpy(), 用,to_list()就好了

dgl error记录
1.AttributeError: ‘NoneType’ object has no attribute ‘is_block’
你的数据中存在空值,请删除他

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值