
pytorch bug
ciki_tang
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
pycharm 断点无效debug记录
debug原创 2022-10-08 00:09:50 · 865 阅读 · 0 评论 -
RuntimeError: Expected object of device type cuda but got device type cpu for argument #2 ‘mat1‘ in
pycharm运行的好好的,一上服务器都是问题,哭了RuntimeError: Expected object of device type cuda but got device type cpu for argument #2 'mat1' in call to _th_addmmPytorch中想使用CUDA对程序计算进行加速,object的device类型期望得到的是cuda类型,但是实际上的类型确实cpu类型device = torch.device("cuda...原创 2021-10-13 16:43:21 · 667 阅读 · 0 评论 -
TypeError: can‘t convert np.ndarray of type numpy.complex128. The only supported types are: float64.
Test_data = torch.from_numpy(np.array(Test_data)).type(torch.complex64)# Test_data = torch.tensor(Test_data, dtype = torch.complex64)在 pycharm上可以运行,但是服务器出现问题服务器运行程序时出现问题:TypeError: can't convert np.ndarray of type numpy.complex128. The only supported.原创 2021-10-13 14:32:25 · 2745 阅读 · 0 评论 -
Bug:IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)
Bug:IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)代码:a=torch.tensor([2,1])b=torch.chunk(a,2,1)错误原因:print(a.shape)torch.Size([2])a的 shape是[2] ,不是[1,2],是一个一维向量,因此不存在 dim=1的情况修改b=torch.chunk(a,2,0)b=...原创 2021-10-12 14:45:32 · 656 阅读 · 0 评论 -
TypeError: object of type ‘float‘ has no len()
inputs = torch.rand(10, 50, 40)lin = CLinear(in_neurons = inputs.shape[-1]/2, n_neurons = 100)output = lin(inputs)print(output.shape)TypeError: object of type 'float' has no len()错误原因:inputs.shape[-1]/2是一个 float类型,在CLinear调用时候用到 len()函数报错解决办...原创 2021-10-11 20:56:28 · 1215 阅读 · 0 评论 -
ValueError: unsupported format character ‘j‘ (0x6a) at index 4
setattr(self, 'res%j' % j, res)报错,ValueError: unsupported format character 'j' (0x6a) at index 4出现原因分析:出现这种错误一般是在Python中写其他语言的代码,%在字符串中作为格式化字符串的关键字,当其后为诸如n、c、s时进行正常转义解决办法(不太对):使用%%,即表示非关键字的%(推荐); 使用\%,有些情况下适用。修改1, setattr(self, 'res%%...原创 2021-10-10 17:56:16 · 1982 阅读 · 0 评论 -
TypeError: can‘t convert np.ndarray of type numpy.complex128. The only supported types are: double,
TypeError: can't convert np.ndarray of type numpy.complex128. The only supported types are: double, float, float16, int64, int32, and uint8.code:Test_data = torch.from_numpy(np.array(Test_data)).type(torch.complex64)改 code:Test_data = torch.tenso原创 2021-10-09 02:19:48 · 525 阅读 · 0 评论 -
UserWarning:Named tensors and all their associated APIs are an experimental feature...
UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at ..\c10/core/TensorImpl.h:1156.) return ..原创 2021-10-04 14:48:30 · 14502 阅读 · 5 评论 -
python bug: TypeError: ‘bool‘ object is not iterable
'bool' object is not iterable需要在 bool放到列表里sum([ts[i] != rs[i]])原创 2021-09-20 15:23:41 · 7068 阅读 · 1 评论 -
莫凡pytorch GAN 学习 bug记录1
bug1:one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [128, 15]], which is output 0 of TBackward, is at version 2; expected version 1 instead. Hint: enable anomaly detection to find the op原创 2021-09-15 12:06:30 · 348 阅读 · 0 评论