0

I am new to Tensorflow and am currently working on Tensorflow2. I'm still having a hard time writing code, because I don't have the possibility to debug.

I already tried to get further with the line:

tf.executing_eagerly()

and

tf.print()

but this is only a small help compared to the "normal" debugging in python.

Is there a better possibility to debug the code and to view the content of variables?

The only thing I currently get is this view, but that doesn't give me any insight into the actual variables either:enter image description here

1 Answer 1

1

Rather than using tf.print, use the normal Python's print if you are eagerly executing. You will be able to see the contents of the variables.

Sign up to request clarification or add additional context in comments.

6 Comments

Unfortunately I do not see the content of the variable. I see information during debugging like "dtype", "shape", "graph", "value_index" and "_name" but unfortunately no information about the content of the tensor
If you are eagerly executing, it will show you the contents.
if I use print() in eager mode i get the following output: array([<tf.Tensor 'strided_slice_6:0' shape=(1,) dtype=int32>, <tf.Tensor 'strided_slice_8:0' shape=(1,) dtype=int32>, <tf.Tensor 'add_4:0' shape=(1,) dtype=int32>, <tf.Tensor 'add_5:0' shape=(1,) dtype=int32>], dtype=object)
Just type the variable name and hit enter. If you are doing this in terminal or else just leave the name of variable there and run the code.
I use Visual Studio code as IDE. If I enter the pure variable name in a line, then no output is generated or nothing is output on the console
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.