How to use tf.summary.text?

TensorFlow 1.1.0rc2 supports Text in its dashboard, but how can I register something that appears there? The TensorFlow master branch has a link to tf.summary.text, but nothing is called, available in 1.1.0rc2.

+4
source share
2 answers

https://github.com/tensorflow/tensorflow/releases

Hotfix notes say it was added only in v1.2.0

Perhaps the code exists in previous versions, but when it was installed / built, it did not turn on?

+2
source

I am using Tensorflow 1.4

, , . , , , tf.py_func, .

import tensorflow as tf

# Input tensor
a = tf.constant([ord('a'),ord('b')])

# Function in python
def asciiToString(x):
    s = ""
    for c in x:
        s += chr(c)
    return s

print(asciiToString([97,98]))

b = tf.py_func(asciiToString,[a],tf.string)

# Save summary
tf.summary.text('my_text',b)

summaries = tf.summary.merge_all()  

with tf.Session() as sess:
    summaryWriter = tf.summary.FileWriter('./logs',sess.graph) 
    sess.run(tf.global_variables_initializer())
    print(sess.run(a))
    print(sess.run(b))
    summary_output = sess.run(summaries)
    summaryWriter.add_summary(summary_output,0)
0

Source: https://habr.com/ru/post/1675047/


All Articles