在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)