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

Function UnsortedSegmentSumGrad

tensorflow/cc/gradients/math_grad.cc:1325–1344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1323REGISTER_GRADIENT_OP("UnsortedSegmentMin", UnsortedSegmentMinOrMaxGrad);
1324
1325Status UnsortedSegmentSumGrad(const Scope& scope, const Operation& op,
1326 const std::vector<Output>& grad_inputs,
1327 std::vector<Output>* grad_outputs) {
1328 if (op.num_inputs() != 3) {
1329 return errors::InvalidArgument("UnsortedSegmentSum requires 3 arguments");
1330 }
1331
1332 if (grad_inputs.size() != 1) {
1333 return errors::InvalidArgument(
1334 "UnsortedSegmentSum grad requires 1 grad input");
1335 }
1336
1337 auto zero_clipped_indices = GetZeroClippedIndices(scope, op.input(1));
1338 auto is_positive = GetIsPositive(scope, grad_inputs[0], op.input(1));
1339 grad_outputs->push_back(GatherDropNegatives(
1340 scope, grad_inputs[0], zero_clipped_indices, is_positive));
1341 grad_outputs->push_back(NoGradient());
1342 grad_outputs->push_back(NoGradient());
1343 return scope.status();
1344}
1345
1346REGISTER_GRADIENT_OP("UnsortedSegmentSum", UnsortedSegmentSumGrad);
1347

Callers

nothing calls this directly

Calls 10

InvalidArgumentFunction · 0.85
GetZeroClippedIndicesFunction · 0.85
GetIsPositiveFunction · 0.85
GatherDropNegativesFunction · 0.85
NoGradientFunction · 0.85
num_inputsMethod · 0.45
sizeMethod · 0.45
inputMethod · 0.45
push_backMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected