我是靠谱客的博主 无心春天,这篇文章主要介绍AttributeError: module 'tensorflow.contrib.rnn' has no attribute 'BasicLSTMCell',现在分享给大家,希望可以做个参考。

在windows上安装了tensorflow1.2

写一个RNN代码测试的时候,出现错误

AttributeError: module 'tensorflow.contrib.rnn' has no attribute 'BasicLSTMCell'

 

原因是没有BasicLSTMCell,tensorflow1.2.中改了函数位置,解决如下:

tf.nn.rnn_cell.BasicLSTMCell(num_hidden, forget_bias=1.0) 

 

同理,另一个改为

outputs, states = tf.nn.rnn(lstm_cell, x, dtype=tf.float32)

最后

以上就是无心春天最近收集整理的关于AttributeError: module 'tensorflow.contrib.rnn' has no attribute 'BasicLSTMCell'的全部内容,更多相关AttributeError:内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(121)

评论列表共有 0 条评论

立即
投稿
返回
顶部