0

I'm going a tutorial of Tensorflow.

I would like to display the values of variables W and b, which are the weight and bias respectively and placeholders x, y by using print.

Is it possible to display?

print x,y,b,W

What I see currently is as the following

Tensor("Placeholder:0", shape=TensorShape([Dimension(None), Dimension(784)]), dtype=float32)
Tensor("Softmax:0", shape=TensorShape([Dimension(None), Dimension(10)]), dtype=float32)
tensorflow.python.ops.variables.Variable object at 0x1006b0b90>
tensorflow.python.ops.variables.Variable object at 0x101b76410>
Uvuvwevwevwe
  • 971
  • 14
  • 30

1 Answers1

6

You have 3 options:

  1. use tf.Print this is an identity op with the side effect of printing data when evaluating.
  2. manually evaluate the variables:

    print x.eval(), y.eval(), b.eval() , W.eval()

  3. manually evaluate the variables in a single call: assuming sess as the current tf.Session variable

    print sess.run([x,y,b,W])

nessuno
  • 26,493
  • 5
  • 83
  • 74