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

Function DivGrad

tensorflow/cc/gradients/math_grad.cc:430–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

428REGISTER_GRADIENT_OP("Mul", MulGrad);
429
430Status DivGrad(const Scope& scope, const Operation& op,
431 const std::vector<Output>& grad_inputs,
432 std::vector<Output>* grad_outputs) {
433 auto x_1 = ConjugateHelper(scope, op.input(0));
434 auto x_2 = ConjugateHelper(scope, op.input(1));
435 // y = x_1 / x_2
436 // dy/dx_1 = 1/x_2
437 // dy/dx_2 = -x_1/x_2^2
438 auto gx_1 = Div(scope, grad_inputs[0], x_2);
439 auto gx_2 = Mul(scope, grad_inputs[0],
440 Div(scope, Div(scope, Neg(scope, x_1), x_2), x_2));
441 return BinaryGradCommon(scope, op, grad_outputs, gx_1, gx_2);
442}
443REGISTER_GRADIENT_OP("Div", DivGrad);
444
445Status RealDivGrad(const Scope& scope, const Operation& op,

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected