如何在TensorFlow中打印Tensor对象的值?
我一直在TensorFlow中使用矩阵乘法的介绍性示例。
matrix1 = tf.constant([[3., 3.]])matrix2 = tf.constant([[2.],[2.]])product = tf.matmul(matrix1, matrix2)
当我打印产品时,它将其显示为Tensor
对象:
<tensorflow.python.framework.ops.Tensor object at 0x10470fcd0>
但我怎么知道它的价值product
?
以下内容没有帮助:
print productTensor("MatMul:0", shape=TensorShape([Dimension(1), Dimension(1)]), dtype=float32)
我知道图表会运行Sessions
,但是没有任何方法可以在Tensor
不运行图形的情况下检查对象的输出session
?
相关分类