| 342 | ~WhileOp() override {} |
| 343 | |
| 344 | void ComputeAsync(OpKernelContext* ctx, DoneCallback done) override { |
| 345 | auto lib = ctx->function_library(); |
| 346 | OP_REQUIRES_ASYNC(ctx, lib != nullptr, |
| 347 | errors::Internal("No function library"), done); |
| 348 | |
| 349 | // TODO(b/37549631): Because this op has `SetIsStateful()` in its op |
| 350 | // registration, this kernel may be shared by multiple subgraphs, which have |
| 351 | // different associated `FunctionLibraryRuntime` objects and hence different |
| 352 | // `FHandle` namespaces. So we must call Instantiate() to make sure we get |
| 353 | // the correct function handles with respect to `lib`. Note the underlying |
| 354 | // `lib->Instantiate()` caches the created function handles, so calling |
| 355 | // `Instantiate()` repeatedly on the same `lib` and function is cheap. |
| 356 | FHandle cond_handle; |
| 357 | FHandle body_handle; |
| 358 | OP_REQUIRES_OK_ASYNC(ctx, Instantiate(lib, cond_func_, &cond_handle), done); |
| 359 | OP_REQUIRES_OK_ASYNC(ctx, Instantiate(lib, body_func_, &body_handle), done); |
| 360 | (new State(this, ctx, cond_handle, body_handle, done))->Start(); |
| 361 | } |
| 362 | |
| 363 | private: |
| 364 | NameAttrList cond_func_; |
nothing calls this directly
no test coverage detected