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

Function SubGrad

tensorflow/cc/gradients/math_grad.cc:404–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

402REGISTER_GRADIENT_OP("AddV2", AddGrad);
403
404Status SubGrad(const Scope& scope, const Operation& op,
405 const std::vector<Output>& grad_inputs,
406 std::vector<Output>* grad_outputs) {
407 // y = x_1 - x_2
408 // dy/dx_1 = 1
409 // dy/dx_2 = -1
410 auto gx_1 = Identity(scope, grad_inputs[0]);
411 auto gx_2 = Neg(scope, grad_inputs[0]);
412 return BinaryGradCommon(scope, op, grad_outputs, gx_1, gx_2);
413}
414REGISTER_GRADIENT_OP("Sub", SubGrad);
415
416Status MulGrad(const Scope& scope, const Operation& op,

Callers

nothing calls this directly

Calls 3

BinaryGradCommonFunction · 0.85
IdentityFunction · 0.50
NegFunction · 0.50

Tested by

no test coverage detected