Python
1# torchのtensor変数affinedImgsを生成 2affinedImgs = torch.tensor([trainingBatch.shape[0]*len(angles),trainingBatch.shape[1]], device=trainingBatch.device, dtype=trainingBatch.dtype, requires_grad=True)#trainingBatch.dtype=torch.float32 3 4w=h=28 5npImg=img.reshape(w,h).numpy() 6 7# n*len(trainingBatch)+i という位置に 《torch.from_numpy(cv2.warpAffine(npImg, mats[n],(w,h))).float()》を設定したい: 8affinedImgs[n*len(trainingBatch)+i] = torch.from_numpy(cv2.warpAffine(npImg, mats[n],(w,h))).float() 9
RuntimeError: expand(torch.FloatTensor{[28, 28]}, size=[]): the number of sizes provided (0) must be greater or equal to the number of dimensions in the tensor (2)
いろいろエラーメッセージと戦った後、上記のようなRuntimeErrorに定着しているようです。
もう1日もかかったので、皆さんの助けをお願い申し上げます。
あなたの回答
tips
プレビュー