首页 > 解决方案 > 张量流调试

问题描述

        y1 = tf.stack([55, 0, 55])
        y2 = tf.stack([11 22 44])
        y3 = tf.constant([0., 0., 1.])
        x = tf.stack([y1, y2, y3])
        x1 = tf.reshape(x, [3, 3])

有没有办法打印或获得上述张量x1x在张量流中。tf.printsess.eval(x1)?_ 它似乎没有打印堆叠的框架。

也试过tfdg

sess = tf.Session()
        sess = tf_debug.TensorBoardDebugWrapperSession(sess, "Host:7000")
        sess.run(x1)

标签: tensorflow

解决方案


做的时候

import tensorflow as tf
import numpy as np

tf.reset_default_graph()
with tf.Session() as sess:
    y1 = tf.stack([55, 0, 55])
    y2 = tf.stack([11, 22, 44])
    y3 = tf.constant([0, 0, 1])

    x_tmp = tf.stack([y1, y2, y3])
    x1 = tf.reshape(x, [3, 3])

    x_res, x1_res = sess.run([x, x1])


    print(x_res)
    print(x1_res)

好像打印出来了

[[55  0 55]
 [11 22 44]
 [ 0  0  1]]
[[55  0 55]
 [11 22 44]
 [ 0  0  1]]

正好?也许我误解了这个问题


推荐阅读