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

Function IsZero

tensorflow/python/ops/nn_grad.py:533–541  ·  view source on GitHub ↗
(g)

Source from the content-addressed store, hash-verified

531 grad = _BroadcastMul(grad_loss, softmax_grad)
532
533 def IsZero(g):
534 # Some introspection to check if the gradient is feeding zeros
535 if context.executing_eagerly():
536 # TODO(apassos) add an efficient way to detect eager zeros here.
537 return False
538 if g.op.type in ("ZerosLike", "Zeros"):
539 return True
540 const_fill_value = tensor_util.constant_value(g)
541 return const_fill_value is not None and (const_fill_value == 0).all()
542
543 logits = op.inputs[0]
544 if grad_grad is not None and not IsZero(grad_grad):

Callers 1

Calls 2

executing_eagerlyMethod · 0.80
allMethod · 0.45

Tested by

no test coverage detected