| 428 | REGISTER_GRADIENT_OP("Mul", MulGrad); |
| 429 | |
| 430 | Status 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 | } |
| 443 | REGISTER_GRADIENT_OP("Div", DivGrad); |
| 444 | |
| 445 | Status RealDivGrad(const Scope& scope, const Operation& op, |
nothing calls this directly
no test coverage detected