質問編集履歴

1

RNNのエラー→LSTMのエラー

2021/12/20 12:54

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -42,21 +42,21 @@
42
42
 
43
43
  IndexError Traceback (most recent call last)
44
44
 
45
- /tmp/ipykernel_170/1121976969.py in <module>
45
+ /tmp/ipykernel_344/3488387848.py in <module>
46
-
46
+
47
- 16 T_batch = T_train[perm[idx:idx+batch_size]]
47
+ 21 #total_rnn_loss += rnn_loss*len(X_batch)
48
-
48
+
49
- 17
49
+ 22
50
-
50
+
51
- ---> 18 rnn_loss = rnn_model.forward(X_batch, T_batch)
51
+ ---> 23 lstm_loss = lstm_model.forward(X_batch, T_batch)
52
-
52
+
53
- 19 rnn_model.backward()
53
+ 24 lstm_model.backward()
54
-
54
+
55
- 20 optimizer1.update(rnn_model.params, rnn_model.grads)
55
+ 25 optimizer2.update(lstm_model.params, lstm_model.grads)
56
-
57
-
58
-
56
+
57
+
58
+
59
- /tmp/ipykernel_170/1293036090.py in forward(self, xs, ts)
59
+ /tmp/ipykernel_344/3951171937.py in forward(self, xs, ts)
60
60
 
61
61
  30 def forward(self, xs, ts):
62
62
 
@@ -70,7 +70,7 @@
70
70
 
71
71
 
72
72
 
73
- /tmp/ipykernel_170/877901989.py in forward(self, x, t)
73
+ /tmp/ipykernel_344/877901989.py in forward(self, x, t)
74
74
 
75
75
  69 self.t = self.t.argmax(axis=0)
76
76
 
@@ -84,7 +84,7 @@
84
84
 
85
85
 
86
86
 
87
- /tmp/ipykernel_170/689892580.py in cross_entropy_error(y, t)
87
+ /tmp/ipykernel_344/689892580.py in cross_entropy_error(y, t)
88
88
 
89
89
  26 batch_size = y.shape[0]
90
90