深度学习Pytorch
晴朗_
Until the thought of the scenery into the road
展开
-
TypeError: rsub() received an invalid combination of arguments - got (Tensor, numpy.ndarray), but
TypeError: rsub() received an invalid combination of arguments - got (Tensor, numpy.ndarray), but expected one of:(Tensor input, Tensor other, *, Number alpha)(Tensor input, Number other, Number alpha)在写Logistic回归最后,将模型的参数取出来,并将直线画出来,报错原因:张量变量不能在一个式子原创 2021-03-08 21:08:53 · 6956 阅读 · 1 评论 -
RuntimeError: Found dtype Double but expected Float
RuntimeError: Found dtype Double but expected Float在写 Logistic回归的代码时 的报错说明此时需要float型数据,但识别到double型数据,此时需要做一下类型转换原: # 训练模型 out = logistic_model(x) loss = criterion(out, y)修改: x = x.to(torch.float32) y = y.to(torch.float32) out = logistic_mo原创 2021-03-08 17:20:59 · 7930 阅读 · 3 评论