tensorflow提示出错module 'tensorflow.contrib' has no attribute 'bidirectional_rnn'

在学习RNN的过程中,运行程序,报错

 File "model.py", line 21, in __init__
    output, _, _ = tf.contrib.static_bidirectional_rnn(....)

AttributeError: module 'tensorflow.contrib' has no attribute 'bidirectional_rnn'  

tensorflow版本为1.0.1
百度之,排在最上面的结果
说把tf.contrib.rnn.static_bidirectional_rnn()改成tf.nn.bidirectional_dynamic_rnn()
excuse me????
为什么不说把tensorflow改成pytorch呢?
然后排在第二的结果
完美地说明并解决了这个问题。
大意为tensorflow的代码里头文件有错误…
打开tensorflow的安装路径,找到

tensorflow/contrib/rnn/__init__.py

@@LSTMBlockCell
@@GRUBlockCell
@@GRUBlockCellV2
@@FusedRNNCell
@@FusedRNNCellAdaptor
@@TimeReversedFusedRNN
@@LSTMBlockFusedCell
@@CoupledInputForgetGateLSTMCell
@@TimeFreqLSTMCell
@@GridLSTMCell
@@BidirectionalGridLSTMCell
@@NASCell
@@UGRNNCell
@@IntersectionRNNCell
@@PhasedLSTMCell
@@ConvLSTMCell
@@Conv1DLSTMCell
@@Conv2DLSTMCell

像这样一堆的东西里面,随便找个地方加入一行

@@stack_bidirectional_rnn

问题解决

你可能感兴趣的:(tensorflow提示出错module 'tensorflow.contrib' has no attribute 'bidirectional_rnn')