Reputation: 395
I have the following test program in Python:
import tensorflow as tf
sess = tf.InteractiveSession()
# Some tensor we want to print the value of
a = tf.one_hot(1,5)
# Add print operation
a = tf.Print(a, [a], message = "This is a: ")
# Add more elements of the graph using a
b = tf.add(a, a)
b.eval()
I call the function that shall create a nice one hot encoding. I would expect that the output is:
array([0., 1., 0., 0., 0.], dtype=float32)
But instead the output is:
array([0., 2., 0., 0., 0.], dtype=float32)
Why?
Upvotes: 1
Views: 50
Reputation: 2796
You are adding a
to itself, and then printing the addition. So essentially... a= 1; print (a+a)
Obviously, that's not how it's written, but I sure hope that 1+1 is 2.
Upvotes: 2