我的图表看起来像这样:
I W
\ /
E
|
X1...Xn
我想替换操作E以获得这样的新图:
I Q
\ /
L
|
X1...Xn
但是我迷失了graph_editor界面
我尝试过:ge.graph_replace(E, {E: L})
,但我得到:ValueError: Targets and replacements are not connected!
。
编辑:代码看起来像那样
with tf.Graph().as_default():
saver = tf.train.import_meta_graph(FLAGS.load_model + ".meta")
graph = tf.get_default_graph()
codebooks, labels = read_qnpy(FLAGS.output_qnpy)
with tf.variable_scope('Output_qnpy'):
embeddings = qembs_graph(codebooks, labels)
all_ids = graph.get_tensor_by_name('Model/Output/nce_loss/concat:0')
el = graph.get_tensor_by_name('Model/Output/nce_loss/embedding_lookup:0')
word_lookup = tf.nn.embedding_lookup(embeddings, all_ids, name="word_lookup")
ge.graph_replace(el, {el: word_lookup})