| 156 | REGISTER_GRADIENT_OP("Log", LogGrad); |
| 157 | |
| 158 | Status 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 | } |
| 170 | REGISTER_GRADIENT_OP("Log1p", Log1pGrad); |
| 171 | |
| 172 | Status SinhGrad(const Scope& scope, const Operation& op, |
nothing calls this directly
no test coverage detected