MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _maybe_colocate_with

Function _maybe_colocate_with

tensorflow/python/ops/gradients_util.py:303–309  ·  view source on GitHub ↗

Context to colocate with `op` if `colocate_gradients_with_ops`.

(op, gradient_uid, colocate_gradients_with_ops)

Source from the content-addressed store, hash-verified

301
302@contextlib.contextmanager
303def _maybe_colocate_with(op, gradient_uid, colocate_gradients_with_ops): # pylint: disable=invalid-name
304 """Context to colocate with `op` if `colocate_gradients_with_ops`."""
305 if colocate_gradients_with_ops:
306 with ops._colocate_with_for_gradient(op, gradient_uid): # pylint: disable=protected-access
307 yield
308 else:
309 yield
310
311
312def _IsPartitionedCall(op):

Callers 2

_DefaultGradYsFunction · 0.85
_GradientsHelperFunction · 0.85

Calls 1

Tested by

no test coverage detected