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

Function AtanGrad

tensorflow/cc/gradients/math_grad.cc:363–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361REGISTER_GRADIENT_OP("Tan", TanGrad);
362
363Status AtanGrad(const Scope& scope, const Operation& op,
364 const std::vector<Output>& grad_inputs,
365 std::vector<Output>* grad_outputs) {
366 // y = arctan(x)
367 // dy/dx = 1 / (1 + x^2)
368 // dx = dy * (1 / (1 + x^2)
369 auto one = Cast(scope, Const(scope, 1.0), op.input(0).type());
370 auto dydx = Reciprocal(scope, Add(scope, one, Square(scope, op.input(0))));
371 auto dx = Mul(scope, grad_inputs[0], dydx);
372 grad_outputs->push_back(dx);
373 return scope.status();
374}
375REGISTER_GRADIENT_OP("Atan", AtanGrad);
376
377// BinaryGradCommon handles the setup for binary ops that broadcast

Callers

nothing calls this directly

Calls 10

typeMethod · 0.65
CastFunction · 0.50
ConstFunction · 0.50
ReciprocalFunction · 0.50
AddFunction · 0.50
SquareFunction · 0.50
MulFunction · 0.50
inputMethod · 0.45
push_backMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected