AttributeError: module 'tensorflow' has no attribute 'div'

AttributeError: module 'tensorflow' has no attribute 'div'

我正在尝试 运行 这个 code file 使用 google colab。虽然我得到了一些输出,但出现了错误

AttributeError: module 'tensorflow' has no attribute 'div'

像我遇到的大多数问题一样,我在堆栈溢出上查找了这个问题,但没有解决方案。有人,请帮助我理解代码有什么问题。我是 TensorFlow 的新手。

注意:我会在这里粘贴整个代码,但它有 1400 多行代码,所以我直接超链接了文件,因为人们可能会生气,而且这样做 post 会变得很长.但如果需要,我可以编辑 post 并将整个代码粘贴到此处。

tf.div 基于旧的 Python 2 划分方案,已被删除。您应该改用 tf.truedivtf.divide