| 1189 | REGISTER_GRADIENT_OP("Cast", CastGrad); |
| 1190 | |
| 1191 | Status SelectGrad(const Scope& scope, const Operation& op, |
| 1192 | const std::vector<Output>& grad_inputs, |
| 1193 | std::vector<Output>* grad_outputs) { |
| 1194 | if (op.num_inputs() != 3) { |
| 1195 | return errors::InvalidArgument("Select requires 3 arguments"); |
| 1196 | } |
| 1197 | if (grad_inputs.size() != 1) { |
| 1198 | return errors::InvalidArgument("Select grad requires 1 grad input"); |
| 1199 | } |
| 1200 | |
| 1201 | auto c = op.input(0); |
| 1202 | auto zeros = ZerosLike(scope, grad_inputs[0]); |
| 1203 | grad_outputs->push_back(NoGradient()); // Condition |
| 1204 | grad_outputs->push_back(Where3(scope, c, grad_inputs[0], zeros)); |
| 1205 | grad_outputs->push_back(Where3(scope, c, zeros, grad_inputs[0])); |
| 1206 | return scope.status(); |
| 1207 | } |
| 1208 | REGISTER_GRADIENT_OP("Select", SelectGrad); |
| 1209 | |
| 1210 | Status SelectV2Grad(const Scope& scope, const Operation& op, |
nothing calls this directly
no test coverage detected