1. AttributeError: module ‘tensorflow’ has no attribute ‘placeholder’
该问题出现的原因是:安装的tensorflow版本是2.0的,所以使用以前的代码tensorflow中的函数不兼容。
因此,为了解决这个问题,我们必须把
[En]
Therefore, in order to solve this problem, we must put
import tensorflow as tf
改成:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
问题类型:AttributeError: module ‘tensorflow’ has no attribute ‘set_random_seed’,最后一个引号里面的内容可能不一样,但问题的类型是一样的。
2. TypeError: iter() returned non-iterator of type ‘DataInputTest’
这是python2和python3中,实现遍历功能class实现上的区别。
如果是在Python2中,则:
如果是在Python3中,则:
; 参考资料
- Deep Interest Network (DIN)专题2-运行模型训练代码
- 安装tensorflow遇到问题:AttributeError: module ‘tensorflow’ has no attribute ‘set_random_seed’
Original: https://blog.csdn.net/qq_36643449/article/details/124542494
Author: CC‘s World
Title: 【TensorFlow】TensorFlow报错及解决方法(持续更新中)
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/496901/
转载文章受原作者版权保护。转载请注明原作者出处!