解决AttributeError: module ‘tensorflow‘ has no attribute ‘div‘_深度学习

2022-01-14 19:10:40.281030: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
Traceback (most recent call last):
File "E:/Code/Jupyter/mnist-tfv2/文本匹配/model.py", line 45, in <module>
model = get_model()
File "E:/Code/Jupyter/mnist-tfv2/文本匹配/model.py", line 34, in get_model
score = cosine_distance(x_lstm, y_lstm)
File "E:/Code/Jupyter/mnist-tfv2/文本匹配/model.py", line 29, in cosine_distance
tf.div()
AttributeError: module 'tensorflow' has no attribute 'div'

问题原因:
在tensorflow2.0版本取消了​​​tf.div()​​函数

解决办法:
使用2.7.0新版API

tf.math.divide()