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

Function _HasAnyNotNoneGrads

tensorflow/python/ops/gradients_util.py:759–768  ·  view source on GitHub ↗

Return true iff op has real gradient.

(grads, op)

Source from the content-addressed store, hash-verified

757
758
759def _HasAnyNotNoneGrads(grads, op):
760 """Return true iff op has real gradient."""
761 out_grads = _GetGrads(grads, op)
762 for out_grad in out_grads:
763 if isinstance(out_grad, (ops.Tensor, ops.IndexedSlices)):
764 return True
765 if out_grad and isinstance(out_grad, collections_abc.Sequence):
766 if any(g is not None for g in out_grad):
767 return True
768 return False
769
770
771def _UpdatePendingAndEnqueueReady(grads, op, queue, pending_count, loop_state,

Callers 1

Calls 2

_GetGradsFunction · 0.85
anyFunction · 0.85

Tested by

no test coverage detected