| 113 | OP_REQUIRES_OK(ctx, ctx->GetAttr("alpha", &alpha_)); |
| 114 | } |
| 115 | void Compile(XlaOpKernelContext* ctx) override { |
| 116 | auto gradients = ctx->Input("gradients"); |
| 117 | auto features = ctx->Input("features"); |
| 118 | auto output = |
| 119 | xla::Select(xla::Gt(features, xla::ScalarLike(features, 0)), gradients, |
| 120 | gradients * xla::ScalarLike(gradients, alpha_)); |
| 121 | ctx->SetOutput(0, output); |
| 122 | } |
| 123 | float alpha_; |
| 124 | }; |
| 125 | REGISTER_XLA_OP(Name("LeakyReluGrad"), LeakyReluGradOp); |
nothing calls this directly
no test coverage detected