我要去Tensorflow的教程.
我想显示的变量的值W和b,它们是重量和偏压分别和占位符x,y通过利用print.
可以显示吗?
print x,y,b,W
Run Code Online (Sandbox Code Playgroud)
我目前看到的如下
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>
Run Code Online (Sandbox Code Playgroud)
你有3个选择:
tf.Print这是一个标识操作,在评估时会产生打印数据的副作用.手动评估变量:
print x.eval(), y.eval(), b.eval() , W.eval()
在单个调用中手动评估变量:假设sess为当前tf.Session变量
print sess.run([x,y,b,W])