Skip to content Skip to sidebar Skip to footer

In Tensorflow, How Can I Rename A Certain Operation Name?

I think this question may sound weird. Let's say, there is a tensor a. x = tf.placeholder(tf.float32, [None, 2400], name='x') y = tf.placeholder(tf.float32, [None, 2400], name='y')

Solution 1:

This answer suggests that tf.Graph is append only, you cannot modify it.

That being said, a slightly better way to rename a tensor is to use tf.identity like this:

tf.identity(a, name="out")

EDIT: After figuring out answer to one of my own questions, I can see a slightly better way to do this:

graph_def.node[<index of the op you want to change>].name = "out"

the index is usually -1 because final output tensors are in the end of the graph_def

Post a Comment for "In Tensorflow, How Can I Rename A Certain Operation Name?"