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

Function Log1pGrad

tensorflow/cc/gradients/math_grad.cc:158–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156REGISTER_GRADIENT_OP("Log", LogGrad);
157
158Status Log1pGrad(const Scope& scope, const Operation& op,
159 const std::vector<Output>& grad_inputs,
160 std::vector<Output>* grad_outputs) {
161 // y = log1p(x)
162 // dy/dx = 1 / (1 + x)
163 auto one = Cast(scope, Const(scope, 1.0), op.input(0).type());
164 auto dydx = Reciprocal(scope, Add(scope, one, op.input(0)));
165 // grad(x) = grad(y) * conj(dy/dx)
166 grad_outputs->push_back(
167 Mul(scope, grad_inputs[0], ConjugateHelper(scope, dydx)));
168 return scope.status();
169}
170REGISTER_GRADIENT_OP("Log1p", Log1pGrad);
171
172Status SinhGrad(const Scope& scope, const Operation& op,

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected