| 458 | REGISTER_GRADIENT_OP("RealDiv", RealDivGrad); |
| 459 | |
| 460 | Status DivNoNanGrad(const Scope& scope, const Operation& op, |
| 461 | const std::vector<Output>& grad_inputs, |
| 462 | std::vector<Output>* grad_outputs) { |
| 463 | auto x_1 = ConjugateHelper(scope, op.input(0)); |
| 464 | auto x_2 = ConjugateHelper(scope, op.input(1)); |
| 465 | // y = x_1 / x_2 |
| 466 | // dy/dx_1 = 1/x_2 |
| 467 | // dy/dx_2 = -x_1/x_2^2 |
| 468 | auto gx_1 = DivNoNan(scope, grad_inputs[0], x_2); |
| 469 | auto gx_2 = Mul(scope, grad_inputs[0], |
| 470 | DivNoNan(scope, DivNoNan(scope, Neg(scope, x_1), x_2), x_2)); |
| 471 | return BinaryGradCommon(scope, op, grad_outputs, gx_1, gx_2); |
| 472 | } |
| 473 | REGISTER_GRADIENT_OP("DivNoNan", DivNoNanGrad); |
| 474 | |
| 475 | Status SquaredDifferenceGrad(const Scope& scope, const Operation& op, |
nothing calls this directly
no test coverage detected