bug-20220901
ValueError: Cannot load file containing pickled data when allow_pickle=False
pickle
1 feature = np.load(feature_url, allow_pickle=True)
OSError: Failed to interpret file 'array.npy' as a pickle
最后一个npy文件无用
1 self.feature = os.listdir(self.feature_dir)[:10]
Type 'MyDataset' doesn't have expected attribute '__iter__'
无法迭代,添加一条注释抑制警告,而不会完全禁用检查
1 # this comment is necessary to suppress an unnecessary PyCharm warning 2 # noinspection PyTypeChecker 3 train(args, model, device, train_dataset, optimizer, epoch)
RuntimeError: mat1 dim 1 must match mat2 dim 0
特征维度错误,Pytorch获取tensor维度
1 print(tag_feature.size()) #torch.Size([1, 200, 1, 1]) 2 print(tag_feature.shape) #torch.Size([1, 200, 1, 1])
1 tag_feature = torch.tensor(tag_feature)
1 tag_feature = tag_feature.flatten() #拉平
RuntimeError: zero-dimensional tensor (at position 0) cannot be concatenated
两个数据不都是tensor类型