tensorflow1.2中出现错误问题AttributeError: module 'tensorflow.contrib.rnn' has no attribute 'BasicLSTMCell'

故事扮演 提交于 2019-11-30 20:06:16

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

原因是没有BasicLSTMCell,tensorflow1.2.1中改了函数位置

改为tf.nn.rnn_cell.BasicLSTMCell(num_hidden, forget_bias=1.0) 就好

 (2)AttributeError: module 'tensorflow.python.ops.nn' has no attribute 'static_rnn'

原因是没有static_rnn,tensorflow1.2.1中改了函数位置

改为outputs, states = tf.nn.rnn(lstm_cell, x, dtype=tf.float32)就好

或者是替换为tf.nn.dynamic_rnn,不过要注意输入



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!