Skip to content Skip to sidebar Skip to footer

Tensorflow2: How To Print Value Of A Tensor Returned From Tf.function When Eager Execution Is Disabled?

I've read that I can see contents of tf variables by using tf.print inside my tf.function definition. It doesn't work. My __tf.version__ is 2.5.0. I run the following function insi

Solution 1:

You can also try force_tf_compat_v1=True to run the legacy tf.Transform and try to print the function's return by calling the function outside tf.function. Or for the part where you are using tf.transform you can wrap it using tf.Graph as below.

g = tf.Graph()
with g.as_default():
  # Define operations and tensors in `g`.
  c = tf.constant(30.0)

Post a Comment for "Tensorflow2: How To Print Value Of A Tensor Returned From Tf.function When Eager Execution Is Disabled?"