TensorFlow 2.0中contrib被棄用
於是將
from tensorflow.contrib import rnn
替換成
from tensorflow.python.ops import rnn
如果出現
AttributeError: module 'tensorflow.python.ops.rnn' has no attribute 'BasicLSTMCell'
則將
rnn.BasicLSTMCell(num_hidden,forget_bias=1.0)
替換
tf.nn.rnn_cell.BasicLSTMCell(num_hidden,forget_bias=1.0)