Tflearn ValueError: Shape (256, ?) must have rank at least 3
Tflearn ValueError: Shape (256, ?) must have rank at least 3
print(network.shape ) # ( ? , 256, 2, 128 )
network = reshape(network,[-1,256,256])
print(network.shape) # ( ? , 256, 256 ) batch_Size,time_stamp,features
network = bidirectional_rnn(network, GRUCell(32 ), GRUCell(32) )
我正在尝试使用 tflearn 编写 CRNN,这是我得到的日志:
File "data_clean.py", line 117, in sai_net
network = bidirectional_rnn(network, GRUCell(32 ), GRUCell(32) )
File "/usr/local/lib/python2.7/dist-packages/tflearn/layers/recurrent.py", line 374, in bidirectional_rnn
dtype=tf.float32)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 405, in bidirectional_dynamic_rnn
time_major=time_major, scope=fw_scope)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 598, in dynamic_rnn
dtype=dtype)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 661, in _dynamic_rnn_loop
for input_ in flat_input)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 661, in <genexpr>
for input_ in flat_input)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_shape.py", line 654, in with_rank_at_least
raise ValueError("Shape %s must have rank at least %d" % (self, rank))
ValueError: Shape (256, ?) must have rank at least 3
我是不是漏掉了什么,因为张量是三个维度的,第一个是批量大小,我将把它提供给网络。类似的代码在 keras 上完美运行。我在这里错过了什么吗?
似乎是一个已知问题:https://github.com/tflearn/tflearn/issues/818,发生在 tensorflow 1.2 及更高版本中。
print(network.shape ) # ( ? , 256, 2, 128 )
network = reshape(network,[-1,256,256])
print(network.shape) # ( ? , 256, 256 ) batch_Size,time_stamp,features
network = bidirectional_rnn(network, GRUCell(32 ), GRUCell(32) )
我正在尝试使用 tflearn 编写 CRNN,这是我得到的日志:
File "data_clean.py", line 117, in sai_net
network = bidirectional_rnn(network, GRUCell(32 ), GRUCell(32) )
File "/usr/local/lib/python2.7/dist-packages/tflearn/layers/recurrent.py", line 374, in bidirectional_rnn
dtype=tf.float32)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 405, in bidirectional_dynamic_rnn
time_major=time_major, scope=fw_scope)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 598, in dynamic_rnn
dtype=dtype)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 661, in _dynamic_rnn_loop
for input_ in flat_input)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 661, in <genexpr>
for input_ in flat_input)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_shape.py", line 654, in with_rank_at_least
raise ValueError("Shape %s must have rank at least %d" % (self, rank))
ValueError: Shape (256, ?) must have rank at least 3
我是不是漏掉了什么,因为张量是三个维度的,第一个是批量大小,我将把它提供给网络。类似的代码在 keras 上完美运行。我在这里错过了什么吗?
似乎是一个已知问题:https://github.com/tflearn/tflearn/issues/818,发生在 tensorflow 1.2 及更高版本中。