| 61 | OP_REQUIRES_OK(ctx, ctx->GetAttr("alpha", &alpha_)); |
| 62 | } |
| 63 | void Compile(XlaOpKernelContext* ctx) override { |
| 64 | auto features = ctx->Input("features"); |
| 65 | auto prod_with_alpha = features * xla::ScalarLike(features, alpha_); |
| 66 | auto gt_zero = xla::Gt(features, xla::ScalarLike(features, 0)); |
| 67 | auto output = xla::Select(gt_zero, features, prod_with_alpha); |
| 68 | ctx->SetOutput(0, output); |
| 69 | } |
| 70 | float alpha_; |
| 71 | }; |
| 72 | REGISTER_XLA_OP(Name("LeakyRelu"), LeakyReluOp); |
nothing calls this directly
no test coverage detected