import tensorflow as tf
from tensorflow.python import debug as tf_debug
inputs=tf.constant([[[1,2,3,4],[1,0,1,5],[0,1,7,1]],
[[1,8,1,0],[4,1,1,2],[0,5,1,2]]],dtype="float32")
state = tf.constant([[[1,0,1,1],[0,1,1,1],[0,2,1,1]],
[[1,0,1,1],[2,1,1,1],[2,0,1,1]]],dtype="float32")
# lala为一个定义好的函数
score=lala(inputs,state)
sess = tf.Session()
sess = tf_debug.LocalCLIDebugWrapperSession(sess)
sess.run(score)
步骤如下:
第一步:打开Anancode 或Python环境 切换到自己的环境
第二步 :debug Python文件
第三步 :run 文件 可以看到所有Tensor 的名字,在查变量值得时候很有用
第四步:查看中间变量 pt + tensor name
第五步:退出