| 37 | } |
| 38 | |
| 39 | void XlaAotOnlyVarHandleOp::Compile(XlaOpKernelContext* context) { |
| 40 | // Look for a resource of the same name. TF also keys that on the container |
| 41 | // and type attributes, but that doesn't seem necessary. |
| 42 | for (const auto& resource : context->xla_context()->resources()) { |
| 43 | if (resource->kind() == XlaResource::kVariable && |
| 44 | resource->name() == name_) { |
| 45 | context->SetResourceOutput(0, resource.get()); |
| 46 | return; |
| 47 | } |
| 48 | } |
| 49 | context->SetStatus( |
| 50 | errors::InvalidArgument("Variable: ", name_, " not configured")); |
| 51 | } |
| 52 | } // namespace |
| 53 | |
| 54 | REGISTER_XLA_OP(Name("VarHandleOp").CompilationOnly(), XlaAotOnlyVarHandleOp); |
nothing calls this directly
no test coverage detected