pytorch
binqiang2wang
这个作者很懒,什么都没留下…
展开
-
NameError: name ‘LongTensor‘ is not defined
非常简单的一个错误。对于类型,我看的太少。原始报错的代码时:x = x.type(LongTensor) 修改也非常简单:x = x.type(torch.LongTensor) 提供了和我有相同疑惑的人。原创 2022-05-06 10:27:09 · 621 阅读 · 0 评论 -
named_modules named_parameters
从名字就可以看出两者的区别一个是模块信息,一个是参数,但还是想要更直观一点。文字的说法可以看这里这里展示的网络模型的代码来自https://github.com/Yanqi-Chen/Gradient-Rewiring这里进行的修改就是打印出了对应的两个不同的信息:import torchimport torch.nn as nnimport torch.nn.functional as Ffrom spikingjelly.clock_driven import functional, l原创 2022-05-05 15:04:01 · 757 阅读 · 0 评论 -
RuntimeError: Expected tensor for argument #1 ‘indices‘ to have scalar type Long; but got torch.IntT
RuntimeError: Expected tensor for argument #1 ‘indices’ to have scalar type Long; but got torch.IntTensor instead (while checking arguments for embedding)RuntimeError: Expected tensor for argument #1 'indices' to have scalar type Long; but got torch.IntTe原创 2021-07-13 16:43:34 · 4749 阅读 · 1 评论 -
untimeError: scatter_add() expected at most 5 argument(s) but received 6 argument(s).
RuntimeError: scatter_add() expected at most 5 argument(s) but received 6 argument(s). Declaration: scatter_add(Tensor src, Tensor index, int dim=-1, Tensor? out=None, int? dim_size=None) -> (Tensor)代码错误定位到这一行:out = op(src, index, 0, None, dim_size,原创 2021-06-30 20:17:08 · 1247 阅读 · 1 评论 -
Process finished with exit code 135 (interrupted by signal 7: SIGEMT)
用pycharm跑DeVLBert遇到了这个问题,逐步运行,定位在读文件时候的在这里插入图片描述初步判断是文件的问题,暂时为解决。可以考虑使用官网从原始数据做特征处理,太麻烦,暂时放着原创 2021-04-15 16:31:10 · 1146 阅读 · 0 评论 -
tensorboard bad interpreter permission denied
出现这个错误的原因是使用的conda环境是通过拷贝安装的,用pip卸载重新安装tensorboard就可以了。原创 2021-04-06 15:32:27 · 819 阅读 · 2 评论 -
torch has an invalid wheel.
在自己笔记本上使用pip install torch的时候出现了这个问题。通过搜索,运行以下命令安装成功了:pip install torch==1.7.0+cpu torchvision==0.8.1+cpu torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.htmlstackoverflow...原创 2020-12-10 20:21:55 · 9182 阅读 · 6 评论 -
AttributeError NoneType object has no attribute data
错误定位到了这里:def clip_gradient(optimizer, grad_clip): for group in optimizer.param_groups: for param in group['params']: param.grad.data.clamp_(-grad_clip, grad_clip)一开始看到这里AttributeError: ‘NoneType’ object has no attribute ‘data’一直原创 2020-06-04 14:58:18 · 5533 阅读 · 5 评论 -
KeyError: Caught KeyError in replica 0 on device 0.
跑torch代码遇到这个问题。博客上有类似的问题:运行开源库CCPD-RPnet代码,提示「KeyError: Caught KeyError in replica 0 on device 0」错误不过具体的错误提示和我的还是不一样。通过官方论坛里的一个问题主要问题是出现在DataParrallel上。当在多个gpu上跑代码的时候就可能遇到这个问题。解决方法就是用一块GPU跑。...原创 2020-06-02 21:13:13 · 6945 阅读 · 6 评论