| 1323 | REGISTER_GRADIENT_OP("UnsortedSegmentMin", UnsortedSegmentMinOrMaxGrad); |
| 1324 | |
| 1325 | Status 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 | |
| 1346 | REGISTER_GRADIENT_OP("UnsortedSegmentSum", UnsortedSegmentSumGrad); |
| 1347 |
nothing calls this directly
no test coverage detected