質問編集履歴

1

上方修正

2018/11/19 12:27

投稿

taiyo2017
taiyo2017

スコア170

test CHANGED
File without changes
test CHANGED
@@ -1,97 +1 @@
1
1
  AssertionError: Incoming Tensor shape must be 3-D とエラーが出ました。
2
-
3
- Tracebackには
4
-
5
- ```ここに言語を入力
6
-
7
- Traceback (most recent call last):
8
-
9
- File "cnn.py", line 154, in <module>
10
-
11
- net = conv_1d(net, 4, 16, activation='relu')
12
-
13
- File "/Users/xxx/anaconda/xxx/lib/python2.7/site-packages/tflearn/layers/conv.py", line 802, in conv_1d
14
-
15
- assert len(input_shape) == 3, "Incoming Tensor shape must be 3-D"
16
-
17
- AssertionError: Incoming Tensor shape must be 3-D
18
-
19
- ```
20
-
21
- とエラーが出ました。
22
-
23
- コードには、
24
-
25
- ```ここに言語を入力
26
-
27
- # coding: utf-8
28
-
29
- import tensorflow as tf
30
-
31
- import tflearn
32
-
33
-
34
-
35
- from tflearn.layers.core import input_data,dropout,fully_connected
36
-
37
- from tflearn.layers.conv import conv_3d, max_pool_3d
38
-
39
- from tflearn.layers.normalization import local_response_normalization
40
-
41
- from tflearn.layers.estimator import regression
42
-
43
-
44
-
45
- tf.reset_default_graph()
46
-
47
- net = input_data(shape=[20000, 4, 42])
48
-
49
- net = conv_1d(net, 4, 16, activation='relu')
50
-
51
- net = max_pool_1d(net, 1)
52
-
53
- net = tflearn.activations.relu(net)
54
-
55
- net = dropout(net, 0.5)
56
-
57
- net = tflearn.fully_connected(net, 2, activation='softmax')
58
-
59
- net = tflearn.regression(net, optimizer='adam', learning_rate=0.5, loss='categorical_crossentropy')
60
-
61
-
62
-
63
- model = tflearn.DNN(net)
64
-
65
-
66
-
67
- ```
68
-
69
- と書きました。
70
-
71
- ```ここに言語を入力
72
-
73
- net = conv_3d(net, 4, 16, activation='relu')
74
-
75
- net = max_pool_3d(net, 1)
76
-
77
- ```
78
-
79
- と書き換えると、
80
-
81
- ```ここに言語を入力
82
-
83
- Traceback (most recent call last):
84
-
85
- File "cnn.py", line 154, in <module>
86
-
87
- net = conv_3d(net, 4, 16, activation='relu')
88
-
89
- File "/Users/xxx/anaconda/xxx/lib/python2.7/site-packages/tflearn/layers/conv.py", line 1011, in conv_3d
90
-
91
- assert len(input_shape) == 5, "Incoming Tensor shape must be 5-D"
92
-
93
- AssertionError: Incoming Tensor shape must be 5-D
94
-
95
- ```
96
-
97
- のようにエラーが出ました。何が問題でどう修正したら良いのでしょうか?