【问题标题】:Tflearn ValueError: Shape (256, ?) must have rank at least 3Tflearn ValueError:形状(256,?)必须至少排名 3
【发布时间】:2018-05-19 17:53:37
【问题描述】:
    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 上完美运行。我在这里错过了什么吗?

【问题讨论】:

    标签: python tensorflow lstm rnn tflearn


    【解决方案1】:

    似乎是一个已知问题:https://github.com/tflearn/tflearn/issues/818,发生在 tensorflow 1.2 及更高版本中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-07-26
      • 1970-01-01
      • 2022-01-25
      • 1970-01-01
      • 1970-01-01
      • 2022-01-13
      • 2018-04-24
      • 2021-02-16
      相关资源
      最近更新 更多