質問編集履歴

4

sdfsdf

2022/06/25 03:53

投稿

insecticide
insecticide

スコア315

test CHANGED
File without changes
test CHANGED
@@ -11,6 +11,6 @@
11
11
  ```
12
12
  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)
13
13
 
14
- いろいろエラーメッセージ戦った後、上記のようなRuntimeErrorに定着しているようです。
14
+ いろいろエラーメッセージ戦った後、上記のようなRuntimeErrorに定着しているようです。
15
15
  もう1日もかかったので、皆さんの助けをお願い申し上げます。
16
16
 

3

sfさd

2022/06/25 03:52

投稿

insecticide
insecticide

スコア315

test CHANGED
File without changes
test CHANGED
@@ -7,6 +7,7 @@
7
7
 
8
8
  # n*len(trainingBatch)+i という位置に 《torch.from_numpy(cv2.warpAffine(npImg, mats[n],(w,h))).float()》を設定したい:
9
9
  affinedImgs[n*len(trainingBatch)+i] = torch.from_numpy(cv2.warpAffine(npImg, mats[n],(w,h))).float()
10
+
10
11
  ```
11
12
  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)
12
13
 

2

sdf

2022/06/25 03:51

投稿

insecticide
insecticide

スコア315

test CHANGED
File without changes
test CHANGED
@@ -10,3 +10,6 @@
10
10
  ```
11
11
  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)
12
12
 
13
+ いろいろエラーメッセージを戦った後、上記のようなRuntimeErrorに定着しているようです。
14
+ もう1日もかかったので、皆さんの助けをお願い申し上げます。
15
+

1

っっs

2022/06/25 03:48

投稿

insecticide
insecticide

スコア315

test CHANGED
File without changes
test CHANGED
@@ -1,8 +1,11 @@
1
1
  ```Python
2
+ # torchのtensor変数affinedImgsを生成
2
3
  affinedImgs = torch.tensor([trainingBatch.shape[0]*len(angles),trainingBatch.shape[1]], device=trainingBatch.device, dtype=trainingBatch.dtype, requires_grad=True)#trainingBatch.dtype=torch.float32
4
+
3
5
  w=h=28
4
6
  npImg=img.reshape(w,h).numpy()
5
7
 
8
+ # n*len(trainingBatch)+i という位置に 《torch.from_numpy(cv2.warpAffine(npImg, mats[n],(w,h))).float()》を設定したい:
6
9
  affinedImgs[n*len(trainingBatch)+i] = torch.from_numpy(cv2.warpAffine(npImg, mats[n],(w,h))).float()
7
10
  ```
8
11
  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)