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

質問編集履歴

1

カーネルの再起動、input_shapeの変更を行いましたが、エラーは取れませんでした

2020/06/01 14:48

投稿

cognac_n
cognac_n

スコア1

title CHANGED
File without changes
body CHANGED
@@ -13,31 +13,11 @@
13
13
  ### 発生している問題・エラーメッセージ
14
14
 
15
15
  ```
16
+ もともと出ていたエラー
16
17
  ValueError Traceback (most recent call last)
17
18
  <ipython-input-66-94ca9aad4ee1> in <module>
18
19
  ----> 1 history = model.fit(X_train, Y_train, batch_size = batch_size, epochs = epochs)
19
-
20
- D:\Anaconda3\envs\tensorflow-gpu-2\lib\site-packages\tensorflow\python\keras\engine\training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, max_queue_size, workers, use_multiprocessing, **kwargs)
21
- 1534 steps_name='steps_per_epoch',
22
- 1535 steps=steps_per_epoch,
23
- -> 1536 validation_split=validation_split)
24
- 1537
25
- 1538 # Prepare validation data.
26
-
27
- D:\Anaconda3\envs\tensorflow-gpu-2\lib\site-packages\tensorflow\python\keras\engine\training.py in _standardize_user_data(self, x, y, sample_weight, class_weight, batch_size, check_steps, steps_name, steps, validation_split)
28
- 990 x, y, sample_weight = next_element
29
- 991 x, y, sample_weights = self._standardize_weights(x, y, sample_weight,
30
- --> 992 class_weight, batch_size)
31
- 993 return x, y, sample_weights
32
- 994
33
-
34
- D:\Anaconda3\envs\tensorflow-gpu-2\lib\site-packages\tensorflow\python\keras\engine\training.py in _standardize_weights(self, x, y, sample_weight, class_weight, batch_size)
35
- 1152 feed_output_shapes,
36
- 1153 check_batch_axis=False, # Don't enforce the batch size.
37
- -> 1154 exception_prefix='target')
38
- 1155
39
- 1156 # Generate sample-wise weight values given the `sample_weight` and
40
-
20
+ ~略~
41
21
  D:\Anaconda3\envs\tensorflow-gpu-2\lib\site-packages\tensorflow\python\keras\engine\training_utils.py in standardize_input_data(data, names, shapes, check_batch_axis, exception_prefix)
42
22
  321 ': expected ' + names[i] + ' to have ' +
43
23
  322 str(len(shape)) + ' dimensions, but got array '
@@ -47,7 +27,29 @@
47
27
 
48
28
  ValueError: Error when checking target: expected activation_5 to have 3 dimensions, but got array with shape (80739, 4)
49
29
  ```
30
+ ```
31
+ input_shape=(None, X_train.shape[1], X_train.shape[2]) と、書き換えた場合のエラー
32
+ ---------------------------------------------------------------------------
33
+ InvalidArgumentError Traceback (most recent call last)
34
+ D:\Anaconda3\envs\tensorflow-gpu-2\lib\site-packages\tensorflow\python\framework\ops.py in set_shape(self, shape)
35
+ 557 dim_list,
36
+ --> 558 unknown_shape)
37
+ 559 except errors.InvalidArgumentError as e:
50
38
 
39
+ InvalidArgumentError: Shapes must be equal rank, but are 3 and 2
40
+
41
+ During handling of the above exception, another exception occurred:
42
+ ~略~
43
+ D:\Anaconda3\envs\tensorflow-gpu-2\lib\site-packages\tensorflow\python\framework\ops.py in set_shape(self, shape)
44
+ 559 except errors.InvalidArgumentError as e:
45
+ 560 # Convert to ValueError for backwards compatibility.
46
+ --> 561 raise ValueError(str(e))
47
+ 562
48
+ 563 @property
49
+
50
+ ValueError: Shapes must be equal rank, but are 3 and 2
51
+ ```
52
+
51
53
  ### 該当のソースコード
52
54
 
53
55
  ```python3
@@ -90,8 +92,16 @@
90
92
  多変量LSTMについての解説がwebでなかなか見つけ出せず、
91
93
  試行錯誤すらできていません。
92
94
 
95
+ いただいた回答やコメントをもとに試したことは以下です
96
+ ・jupyter notebookカーネルの再起動
97
+ ->エラー内容に変化なし
98
+ ・input_shape=(None, X_train.shape[1], X_train.shape[2]) と、書き換え
99
+ ->モデルのレイヤー積み上げ段階でエラーが出るようになりました。
100
+  エラー内容を追記いたします。
101
+
93
102
  ### 補足情報(FW/ツールのバージョンなど)
94
103
 
95
104
  Windows10
96
105
  python = 3.6.10
97
- tensorflow-gpu = 1.12.0
106
+ tensorflow-gpu = 1.12.0
107
+ エディタ:jupyter notebook