I know that when getting a tensor by name that I must append an output index
ex)
graph.get_tensor_by_name('example:0')
Where :0 is the output index. But why is this necessary?
here is a link to get_tensor_by_name in tensorflow's docs. However, it does not mention specifying an output index.
In TensorFlow, names are given to tf.Operation
objects (which correspond to nodes in the tf.Graph
), and a tf.Tensor
object is named for the tf.Operation
that produces it as an output.
Since a tf.Operation
can have more than one output, to name a tf.Tensor
uniquely, we include its index in the the outputs as part of its name.
Therefore, we chose the following format for the name of a tf.Tensor
object, which is also the value returned by the tf.Tensor.name
property:
<name of operation>:<index of output>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With