When learning tensorflow, I did it according to the official example and found one
Traceback (most recent call last):
File "interactive.py", line 10, in <module>
sub = tf.sub(x,a)
AttributeError: module 'tensorflow' has no attribute 'sub'
As soon as I guess, I guess the name of the function has changed. Sure enough, it has been replaced by substract
# -*- coding: utf-8 -*-
import tensorflow as tf
sess = tf.InteractiveSession()
x = tf.Variable([1.0, 2.0])
a = tf.constant([3.0, 3.0])
x.initializer.run()
sub = tf.subtract(x,a)
print(sub.eval())
Similar Posts:
- Tensorflow reported an error when using session module: attributeerror: module ‘tensorflow’ has no attribute ‘session’, which has been solved
- InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor ‘…
- Tensorflow gradients TypeError: Fetch argument None has invalid type
- Tensorflow error due to uninitialized variable [How to Fix]
- AttributeError: module ‘tensorflow’ has no attribute ‘Session’
- [Solved] Python TensorFlow Error: ‘tensorflow.compat.v2.__internal__’ has no attribute ‘tf2’
- How to optimize for inference a simple, saved TensorFlow 1.0.1 graph?
- [Solved] ImportError: cannot import name pywrap_tensorflow
- “Failed to get convolution algorithm. This is probably because cuDNN failed to initialize”
- AttributeError: module ‘tensorflow‘ has no attribute ‘placeholder‘ [How to Solve]