I've seen tf.identity
used in a few places, such as the official CIFAR-10 tutorial and the batch-normalization implementation on stackoverflow, but I don't see why it's necessary.
What's it used for? Can anyone give a use case or two?
One proposed answer is that it can be used for transfer between the CPU and GPU. This is not clear to me. Extension to the question, based on this: loss = tower_loss(scope)
is under the GPU block, which suggests to me that all operators defined in tower_loss
are mapped to the GPU. Then, at the end of tower_loss
, we see total_loss = tf.identity(total_loss)
before it's returned. Why? What would be the flaw with not using tf.identity
here?