AttributeError: module ‘tensorflow_core.compat.v1‘ has no attribute ‘contrib‘

import tensorflow.compat.v1 as tf


#原
return tf.contrib.rnn.DropoutWrapper(cell, output_keep_prob=self.keep_prob)
#改为
return tf.nn.rnn_cell.DropoutWrapper(cell, output_keep_prob=self.keep_prob)

tf.placeholder() is not compatible with eager execution

#加上
tf.compat.v1.disable_eager_execution()