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

Function SquareGrad

tensorflow/cc/gradients/math_grad.cc:87–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85REGISTER_GRADIENT_OP("Reciprocal", InvGrad);
86
87Status SquareGrad(const Scope& scope, const Operation& op,
88 const std::vector<Output>& grad_inputs,
89 std::vector<Output>* grad_outputs) {
90 // dy/dx = (2 * x)
91 auto two = Cast(scope, Const(scope, 2), op.input(0).type());
92 auto dydx = Mul(scope, two, op.input(0));
93 // grad(x) = grad(y) * conj(dy/dx)
94 grad_outputs->push_back(
95 Mul(scope, grad_inputs[0], ConjugateHelper(scope, dydx)));
96 return scope.status();
97}
98REGISTER_GRADIENT_OP("Square", SquareGrad);
99
100Status SqrtGrad(const Scope& scope, const Operation& op,

Callers

nothing calls this directly

Calls 8

ConjugateHelperFunction · 0.85
typeMethod · 0.65
CastFunction · 0.50
ConstFunction · 0.50
MulFunction · 0.50
inputMethod · 0.45
push_backMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected