teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

コード追加

2020/12/03 13:41

投稿

PPAP_AWS
PPAP_AWS

スコア105

title CHANGED
File without changes
body CHANGED
@@ -237,4 +237,63 @@
237
237
  ^
238
238
  SyntaxError: invalid syntax
239
239
 
240
+ ```
241
+
242
+
243
+
244
+
245
+ 追記。。
246
+ ```
247
+ for epoch in range(epochs):
248
+
249
+ print()
250
+ print(f'Epoch: {epoch+1}')
251
+
252
+ run_train()
253
+
254
+ extending_seq = train_seq[-test_size:].tolist()
255
+
256
+ run_test()
257
+
258
+ plt.figure(figsize=(12, 4))
259
+ plt.xlim(-20, len(y)+20)
260
+ plt.grid(True)
261
+
262
+ plt.plot(y.numpy())
263
+
264
+ plt.plot(
265
+ range(len(y)-test_size, len(y)),
266
+ extending_seq[-test_size:]
267
+ )
268
+
269
+ plt.show()
270
+ ```
271
+
272
+
273
+ エラー内容
274
+ ```Epoch: 1
275
+ -----------------------------------------------------------------------
276
+ NotImplementedError Traceback (most recent call last)
277
+ <ipython-input-212-863045c37b1e> in <module>
278
+ 4 print(f'Epoch: {epoch+1}')
279
+ 5
280
+ ----> 6 run_train()
281
+ 7
282
+ 8 extending_seq = train_seq[-test_size:].tolist()
283
+
284
+ <ipython-input-206-e770668ef1d7> in run_train()
285
+ 10 )
286
+ 11
287
+ ---> 12 train_predicted_label = model.forward(train_window)
288
+ 13 train_loss = criterion(train_precicted_label, correct_label)
289
+ 14
290
+
291
+ ~/opt/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py in _forward_unimplemented(self, *input)
292
+ 173 registered hooks while the latter silently ignores them.
293
+ 174 """
294
+ --> 175 raise NotImplementedError
295
+ 176
296
+ 177
297
+
298
+ NotImplementedError:
240
299
  ```

2

文法修正

2020/12/03 13:41

投稿

PPAP_AWS
PPAP_AWS

スコア105

title CHANGED
@@ -1,1 +1,1 @@
1
- The Number of Training Data が一致しない。 Python
1
+ SyntaxError: invalid syntax エラー Python
body CHANGED
File without changes

1

文法修正

2020/12/03 12:10

投稿

PPAP_AWS
PPAP_AWS

スコア105

title CHANGED
File without changes
body CHANGED
@@ -2,8 +2,8 @@
2
2
  また、print("The Number of Training Data: ", len(train_data)) の実行結果が1しかないのですが、本当であれば、564と結果がないといけないのですが、なぜ、データが1つしないのかも教えてくださると助かります。
3
3
 
4
4
  ご教授お願いいたします。
5
-
5
+ 参考動画[リンク内容](https://www.youtube.com/watch?v=KeCK4ml4VVU&t=2178s) 13:41
6
- ```
6
+ ``` 
7
7
  import torch
8
8
  import torch.nn as nn
9
9
  import numpy as np