【发布时间】:2016-03-18 18:33:35
【问题描述】:
我处理大量 dtype="str" 数据。我一直在尝试构建一个简单的图表,如https://www.tensorflow.org/versions/master/api_docs/python/train.html#SummaryWriter。
对于一个简单的操作,我想使用 placeholder 将字符串连接在一起,如 (How to feed a placeholder?)
有人知道如何将字符串张量合并在一起吗?
import tensorflow as tf
sess = tf.InteractiveSession()
with tf.name_scope("StringSequence") as scope:
left = tf.constant("aaa",name="LEFT")
middle = tf.placeholder(dtype=tf.string, name="MIDDLE")
right = tf.constant("ccc",name="RIGHT")
complete = tf.add_n([left,middle,right],name="COMPLETE") #fails here
sess.run(complete,feed_dict={middle:"BBB"})
#writer = tf.train.SummaryWriter("/users/mu/test_out/", sess.graph_def)
【问题讨论】:
标签: python string concatenation tensorflow