该问题出现的原因是:安装的tensorflow版本是2.0的,所以使用以前的代码tensorflow中的函数不兼容。
因此为了解决这个问题,必须把
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’



