4

TensorFlow 1.1.0rc2 has support for Text in its dashboard but how do I actually log something that will show up there? TensorFlow master branch has a reference to tf.summary.text but nothing called that is available in 1.1.0rc2.

user3504575
  • 525
  • 1
  • 6
  • 19
  • Have you seen this link: https://www.tensorflow.org/versions/master/api_docs/python/tf/summary/text ? – standy Apr 20 '17 at 21:34
  • But nothing that is available in 1.1.0rc2? – user3504575 Apr 24 '17 at 13:30
  • The support was added in this commit https://github.com/tensorflow/tensorflow/commit/42c204df8f3e40dffad8ddd2770c0ab881b5a4d8 which looks like 1.1.0-rc2. I have downloaded 1.1.0 via `pip install tensorflow` and there is no tf.summary.text available. How do one enable it? Or was it not included in 1.1.0 by some reason? Very confusing. – user3504575 Apr 30 '17 at 14:42

2 Answers2

2

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

Patch notes says that it was only added in v1.2.0

Perhaps the code is there in previous versions, but when it's installed/built, it's not included?

Multihunter
  • 5,520
  • 2
  • 25
  • 38
0

I am using Tensorflow 1.4

I cannot find any straightforward way to use text summaries as I cannot find any example of how to convert number-like tensors into strings. However, using this post we can write a makeshift function using tf.py_func to achieve the result.

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)
Souradeep Nanda
  • 3,116
  • 2
  • 30
  • 44