How to manually create a tf.Summary()

后端 未结 3 1473
旧巷少年郎
旧巷少年郎 2020-12-04 11:37

I often want to log python variables --as opposed to tf tensors.

In the docs it says that \"you can pass a tf.Summary protocol buffer that you populate

3条回答
  •  臣服心动
    2020-12-04 12:03

    If you want to log a python value you have to create a placeholder that have to be fed when running the tf.Summary op.

    Here's a code snipped

    value_ = tf.placeholder(tf.float32, [])
    summary_op = tf.scalar_summary("value_log", value_)
    my_python_variable = 10
    # define everything else you need...
    # ...
    with tf.Session() as sess:
        for i in range(0, 10):
            sess.run(summary_op, feed_dict={value_: my_python_variable*i})
    

提交回复
热议问题