| 709 | } |
| 710 | |
| 711 | Status InstantiatedCapturedFunction::RunInstantiated( |
| 712 | const std::vector<Tensor>& args, std::vector<Tensor>* rets) { |
| 713 | auto& info = captured_func_->short_circuit_info(); |
| 714 | if (!info.indices.empty()) { |
| 715 | return RunShortCircuit(info, args, captured_func_, rets); |
| 716 | } |
| 717 | |
| 718 | FunctionLibraryRuntime::Options f_opts; |
| 719 | ScopedStepContainer step_container( |
| 720 | f_opts.step_id, [this](const string& name) { |
| 721 | lib_->device()->resource_manager()->Cleanup(name).IgnoreError(); |
| 722 | }); |
| 723 | f_opts.step_container = &step_container; |
| 724 | f_opts.runner = &captured_runner_; |
| 725 | f_opts.create_rendezvous = ShouldCreateRendezvous(); |
| 726 | CancellationManager cancellation_manager; |
| 727 | f_opts.cancellation_manager = &cancellation_manager; |
| 728 | std::function<void()> deregister_fn; |
| 729 | TF_RETURN_IF_ERROR(ConnectCancellationManagers( |
| 730 | cancellation_manager_, &cancellation_manager, &deregister_fn)); |
| 731 | auto cleanup = gtl::MakeCleanup(std::move(deregister_fn)); |
| 732 | |
| 733 | BorrowedArgsCallFrame frame(args, &captured_func_->captured_inputs(), |
| 734 | ret_types_); |
| 735 | Notification n; |
| 736 | Status s; |
| 737 | |
| 738 | lib_->Run(f_opts, f_handle_, &frame, [&n, &s](Status func_status) { |
| 739 | s.Update(func_status); |
| 740 | n.Notify(); |
| 741 | }); |
| 742 | n.WaitForNotification(); |
| 743 | TF_RETURN_IF_ERROR(s); |
| 744 | return frame.ConsumeRetvals(rets); |
| 745 | } |
| 746 | |
| 747 | void InstantiatedCapturedFunction::RunAsync( |
| 748 | IteratorContext* ctx, std::vector<Tensor>&& args, std::vector<Tensor>* rets, |
no test coverage detected