Skip to content
This repository was archived by the owner on Apr 23, 2025. It is now read-only.

Commit 079a14e

Browse files
alextptensorflower-gardener
authored andcommitted
Trying to fix poor interaction between control flow and tpu estimator.
Control flow v1 gradients depend on control flow contexts implementing AddValue. PiperOrigin-RevId: 314162889
1 parent a7bf534 commit 079a14e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tensorflow_estimator/python/estimator/tpu/tpu_estimator.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3834,6 +3834,10 @@ def AddOp(self, op): # pylint: disable=invalid-name
38343834
raise ValueError('{}: Op {} depends on TPU computation {}, '
38353835
'which is not allowed.'.format(self._message, op, c))
38363836

3837+
def AddValue(self, value):
3838+
self.AddOp(value.op)
3839+
return value
3840+
38373841
def __enter__(self):
38383842
# pylint: disable=protected-access
38393843
self._g = tf.compat.v1.get_default_graph()

0 commit comments

Comments
 (0)