人工智能 tensorflow框架-->FAQ 00

1.示例:AttributeError: module 'tensorflow' has no attribute 'sub'

报错信息:

>>> sub=tf.sub(x,a)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute 'sub'

原因分析:TensorFlow新版本修改了许多函数的名字

解决方法:tf.sub()更改为tf.subtract()

备注信息:tf.mul()更改为tf.multiply()

     tf.types.float32更改为tf.float32

        tf.pact()更改为tf.stact()

原文地址:https://www.cnblogs.com/imlvbu/p/7729119.html