相关疑难解决方法(0)

如何在TensorFlow中打印Tensor对象的值?

我一直在TensorFlow中使用矩阵乘法的介绍性示例.

matrix1 = tf.constant([[3., 3.]])
matrix2 = tf.constant([[2.],[2.]])
product = tf.matmul(matrix1, matrix2)
Run Code Online (Sandbox Code Playgroud)

当我打印产品时,它将其显示为Tensor对象:

<tensorflow.python.framework.ops.Tensor object at 0x10470fcd0>
Run Code Online (Sandbox Code Playgroud)

但我怎么知道它的价值product

以下内容没有帮助:

print product
Tensor("MatMul:0", shape=TensorShape([Dimension(1), Dimension(1)]), dtype=float32)
Run Code Online (Sandbox Code Playgroud)

我知道图表会运行Sessions,但是没有任何方法可以在Tensor不运行图形的情况下检查对象的输出session

python tensorflow tensor

239
推荐指数
14
解决办法
35万
查看次数

标签 统计

python ×1

tensor ×1

tensorflow ×1