| 672 | } |
| 673 | |
| 674 | Status InstantiatedCapturedFunction::RunWithBorrowedArgs( |
| 675 | IteratorContext* ctx, const std::vector<Tensor>& args, |
| 676 | std::vector<Tensor>* rets) const { |
| 677 | auto& info = captured_func_->short_circuit_info(); |
| 678 | if (!info.indices.empty()) { |
| 679 | return RunShortCircuit(info, args, captured_func_, rets); |
| 680 | } |
| 681 | |
| 682 | FunctionLibraryRuntime::Options f_opts; |
| 683 | ScopedStepContainer step_container( |
| 684 | f_opts.step_id, [this](const string& name) { |
| 685 | lib_->device()->resource_manager()->Cleanup(name).IgnoreError(); |
| 686 | }); |
| 687 | f_opts.step_container = &step_container; |
| 688 | f_opts.runner = ctx->runner(); |
| 689 | f_opts.create_rendezvous = ShouldCreateRendezvous(); |
| 690 | CancellationManager cancellation_manager; |
| 691 | f_opts.cancellation_manager = &cancellation_manager; |
| 692 | std::function<void()> deregister_fn; |
| 693 | TF_RETURN_IF_ERROR(ConnectCancellationManagers( |
| 694 | cancellation_manager_, &cancellation_manager, &deregister_fn)); |
| 695 | auto cleanup = gtl::MakeCleanup(std::move(deregister_fn)); |
| 696 | |
| 697 | BorrowedArgsCallFrame frame(args, &captured_func_->captured_inputs(), |
| 698 | ret_types_); |
| 699 | Notification n; |
| 700 | Status s; |
| 701 | |
| 702 | lib_->Run(f_opts, f_handle_, &frame, [&n, &s](Status func_status) { |
| 703 | s.Update(func_status); |
| 704 | n.Notify(); |
| 705 | }); |
| 706 | n.WaitForNotification(); |
| 707 | TF_RETURN_IF_ERROR(s); |
| 708 | return frame.ConsumeRetvals(rets); |
| 709 | } |
| 710 | |
| 711 | Status InstantiatedCapturedFunction::RunInstantiated( |
| 712 | const std::vector<Tensor>& args, std::vector<Tensor>* rets) { |
no test coverage detected