| 61 | REGISTER_XLA_OP(Name("VariableShape").IsMetadataOp(), VariableShapeOp); |
| 62 | |
| 63 | class ReadVariableOp : public XlaOpKernel { |
| 64 | public: |
| 65 | explicit ReadVariableOp(OpKernelConstruction* ctx) : XlaOpKernel(ctx) { |
| 66 | OP_REQUIRES_OK(ctx, ctx->GetAttr("dtype", &dtype_)); |
| 67 | } |
| 68 | |
| 69 | void Compile(XlaOpKernelContext* ctx) override { |
| 70 | xla::XlaOp handle; |
| 71 | OP_REQUIRES_OK( |
| 72 | ctx, ctx->ReadVariableInput(0, dtype_, /*shape=*/nullptr, &handle)); |
| 73 | ctx->SetOutput(0, handle); |
| 74 | } |
| 75 | |
| 76 | private: |
| 77 | DataType dtype_; |
| 78 | }; |
| 79 | REGISTER_XLA_OP(Name("ReadVariableOp").CompilationOnly(), ReadVariableOp); |
| 80 | |
| 81 | class AssignVariableOp : public XlaOpKernel { |
no outgoing calls