tensorflow print

tf.Print(input, data, message=None, first_n=None, summarize=None, name=None)

最低要求两个输入,input和data,input是需要打印的变量的名字,data要求是一个list,里面包含要打印的内容。

  • message是需要输出的错误信息
  • first_n指只记录前n次
  • summarize是对每个tensor只打印的条目数量,如果是None,对于每个输入tensor只打印3个元素
  • name是op的名字

a code example

x=tf.constant([2,3,4,5])
x=tf.Print(x, [x, x.shape, 'test', x], message='Debug message:', summarize=100)

with tf.Session() as sess:
    sess.run(x)

# Debug message:[2 3 4 5][4][test][2 3 4 5]
recent article

tensorflow share parameter

tf.Variable()定义变量tf.Variable( initial_value=None,# 第一个参数是必填参数 trainable=True, collections=None, validate_shape=True, caching_device=None, name=None, variable_def=None, dtype=None, expected_shape=None, import_scope=Non...…

computer science deep learning tensorflow blogread
previous article

tensorflow and cuda version

tensorflow各个版本需要的CUDA版本以及Cudnn的对应关系相应的网址为:tensorflow install for linux and macOStensorflow install for windows 版本 Python 版本 编译器 编译工具 cuDNN CUDA tensorflow_gpu-2.0.0-alpha0 2.7、3.3-3.6 ...…

computer science deep learning tensorflow blogread