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

Function DivNoNanGrad

tensorflow/cc/gradients/math_grad.cc:460–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

458REGISTER_GRADIENT_OP("RealDiv", RealDivGrad);
459
460Status DivNoNanGrad(const Scope& scope, const Operation& op,
461 const std::vector<Output>& grad_inputs,
462 std::vector<Output>* grad_outputs) {
463 auto x_1 = ConjugateHelper(scope, op.input(0));
464 auto x_2 = ConjugateHelper(scope, op.input(1));
465 // y = x_1 / x_2
466 // dy/dx_1 = 1/x_2
467 // dy/dx_2 = -x_1/x_2^2
468 auto gx_1 = DivNoNan(scope, grad_inputs[0], x_2);
469 auto gx_2 = Mul(scope, grad_inputs[0],
470 DivNoNan(scope, DivNoNan(scope, Neg(scope, x_1), x_2), x_2));
471 return BinaryGradCommon(scope, op, grad_outputs, gx_1, gx_2);
472}
473REGISTER_GRADIENT_OP("DivNoNan", DivNoNanGrad);
474
475Status SquaredDifferenceGrad(const Scope& scope, const Operation& op,

Callers

nothing calls this directly

Calls 6

ConjugateHelperFunction · 0.85
DivNoNanFunction · 0.85
BinaryGradCommonFunction · 0.85
MulFunction · 0.50
NegFunction · 0.50
inputMethod · 0.45

Tested by

no test coverage detected