I'm doing a beginner course on TensorFlow. The version I have installed is 2.3.0. I have had problems with eager execution since the course's TensorFlow version is different from the one I have installed. Does anyone know how I can perform an eager execution?
As an example,
import tensorflow.compat.v1 as tf
x = tf.constant([3,5,7])
y = tf.constant([1,2,3])
z1 = tf.add(x,y)
z2 = x*y
z3 = z2-z1
print(z2)
with tf.compat.v1.Session() as sess:
a1, a2, a3 = sess.run([z1,z2,z3])
print(a1)
print(a2)
print(a3)
where I get as the output for the eager execution Tensor("mul_6:0", shape=(3,), dtype=int32)
if you want to have eager execution - import tf the regular way, not
tensorflow.compat.v1
. Then there is no need to usesession
at all. just enter formulas and print results: