Enabling partitioned variables to work with TPU.
authorA. Unique TensorFlower <gardener@tensorflow.org>
Fri, 2 Feb 2018 13:38:50 +0000 (05:38 -0800)
committerTensorFlower Gardener <gardener@tensorflow.org>
Fri, 2 Feb 2018 18:38:52 +0000 (10:38 -0800)
commit67f0b8f9ee6b003d6267b375bd8daf76d98015ab
treed18a76c6953c5cc5658c89a7ccd00bc15973b4d2
parentffa37312ab71d338adfb035a5ab71beb0da842ef
Enabling partitioned variables to work with TPU.
When partitioned variables are used in a TPU training loop,
concat gradient operations get generated for which XLA requires
the concat dimension argument to be a constant (or foldable to a constant).
However since such constant is defined outside of the train while context
an Enter node is generated in order to pass it.
The fix consists in detecting such case, and to duplicate the (scalar) constant
inside the while context, so that XLA can succesfully process the resulting
graph.

PiperOrigin-RevId: 184273245
tensorflow/python/ops/array_grad.py