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

質問編集履歴

1

上方修正

2018/11/19 12:27

投稿

taiyo2017
taiyo2017

スコア170

title CHANGED
File without changes
body CHANGED
@@ -1,49 +1,1 @@
1
- AssertionError: Incoming Tensor shape must be 3-D とエラーが出ました。
1
+ AssertionError: Incoming Tensor shape must be 3-D とエラーが出ました。
2
- Tracebackには
3
- ```ここに言語を入力
4
- Traceback (most recent call last):
5
- File "cnn.py", line 154, in <module>
6
- net = conv_1d(net, 4, 16, activation='relu')
7
- File "/Users/xxx/anaconda/xxx/lib/python2.7/site-packages/tflearn/layers/conv.py", line 802, in conv_1d
8
- assert len(input_shape) == 3, "Incoming Tensor shape must be 3-D"
9
- AssertionError: Incoming Tensor shape must be 3-D
10
- ```
11
- とエラーが出ました。
12
- コードには、
13
- ```ここに言語を入力
14
- # coding: utf-8
15
- import tensorflow as tf
16
- import tflearn
17
-
18
- from tflearn.layers.core import input_data,dropout,fully_connected
19
- from tflearn.layers.conv import conv_3d, max_pool_3d
20
- from tflearn.layers.normalization import local_response_normalization
21
- from tflearn.layers.estimator import regression
22
-
23
- tf.reset_default_graph()
24
- net = input_data(shape=[20000, 4, 42])
25
- net = conv_1d(net, 4, 16, activation='relu')
26
- net = max_pool_1d(net, 1)
27
- net = tflearn.activations.relu(net)
28
- net = dropout(net, 0.5)
29
- net = tflearn.fully_connected(net, 2, activation='softmax')
30
- net = tflearn.regression(net, optimizer='adam', learning_rate=0.5, loss='categorical_crossentropy')
31
-
32
- model = tflearn.DNN(net)
33
-
34
- ```
35
- と書きました。
36
- ```ここに言語を入力
37
- net = conv_3d(net, 4, 16, activation='relu')
38
- net = max_pool_3d(net, 1)
39
- ```
40
- と書き換えると、
41
- ```ここに言語を入力
42
- Traceback (most recent call last):
43
- File "cnn.py", line 154, in <module>
44
- net = conv_3d(net, 4, 16, activation='relu')
45
- File "/Users/xxx/anaconda/xxx/lib/python2.7/site-packages/tflearn/layers/conv.py", line 1011, in conv_3d
46
- assert len(input_shape) == 5, "Incoming Tensor shape must be 5-D"
47
- AssertionError: Incoming Tensor shape must be 5-D
48
- ```
49
- のようにエラーが出ました。何が問題でどう修正したら良いのでしょうか?