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

Function _SetGrad

tensorflow/python/ops/gradients_util.py:809–821  ·  view source on GitHub ↗

Sets gradient "grad" in "grads" for tensor "t".

(grads, t, grad)

Source from the content-addressed store, hash-verified

807
808
809def _SetGrad(grads, t, grad):
810 """Sets gradient "grad" in "grads" for tensor "t"."""
811 op = t.op
812 op_grads = grads.get(op)
813 if not op_grads:
814 op_grads = [[] for _ in xrange(len(op.outputs))]
815 grads[op] = op_grads
816 t_grads = op_grads[t.value_index]
817 if isinstance(t_grads, list):
818 t_grads.append(grad)
819 else:
820 assert control_flow_util.IsLoopSwitch(op)
821 op_grads[t.value_index] = grad
822
823
824def _GetGrad(grads, t, unconnected_gradients):

Callers 2

_GradientsHelperFunction · 0.85

Calls 2

getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected