Deep learning: from tensorflow.contrib.rnn import LSTMStateTuple has no contrib module

 from tensorflow.contrib.rnn import LSTMStateTuple

报错:ModuleNotFoundError: No module named ‘tensorflow.contrib‘

Change the code :

import tensorflow._api.v2.compat.v1 as tf
tf.disable_v2_behavior()
from tensorflow._api.v2.compat.v1.nn.rnn_cell import LSTMStateTuple

Guess you like

Origin blog.csdn.net/weixin_44575717/article/details/125335925