| 89 | REGISTER_XLA_OP(Name("AssignVariableOp").CompilationOnly(), AssignVariableOp); |
| 90 | |
| 91 | class AssignAddVariableOp : public XlaOpKernel { |
| 92 | public: |
| 93 | explicit AssignAddVariableOp(OpKernelConstruction* ctx) : XlaOpKernel(ctx) {} |
| 94 | void Compile(XlaOpKernelContext* ctx) override { |
| 95 | DataType type = ctx->input_type(1); |
| 96 | xla::XlaOp handle; |
| 97 | OP_REQUIRES_OK(ctx, |
| 98 | ctx->ReadVariableInput(0, type, /*shape=*/nullptr, &handle)); |
| 99 | handle = xla::Add(handle, ctx->Input(1)); |
| 100 | OP_REQUIRES_OK(ctx, ctx->AssignVariable(0, type, handle)); |
| 101 | } |
| 102 | }; |
| 103 | REGISTER_XLA_OP( |
| 104 | Name("AssignAddVariableOp").TypeConstraint("dtype", kNumericTypes), |
| 105 | AssignAddVariableOp); |
no outgoing calls