| 662 | // In the cross-process scenario, runner isn't used for making the Async |
| 663 | // RPC calls. |
| 664 | struct Options { |
| 665 | // Choose a step ID that is guaranteed not to clash with any |
| 666 | // Session-generated step ID. DirectSession only generates |
| 667 | // non-negative step IDs (contiguous, starting from 0), and |
| 668 | // MasterSession generates 56-bit random step IDs whose MSB is |
| 669 | // always 0, so a negative random step ID should suffice. |
| 670 | const int64 step_id = -std::abs(static_cast<int64>(random::New64())); |
| 671 | |
| 672 | Rendezvous* rendezvous = nullptr; |
| 673 | Rendezvous* global_rendezvous = nullptr; |
| 674 | CancellationManager* cancellation_manager = nullptr; |
| 675 | CollectiveExecutor* collective_executor = nullptr; |
| 676 | ScopedStepContainer* step_container = nullptr; |
| 677 | StepStatsCollectorInterface* stats_collector = nullptr; |
| 678 | |
| 679 | std::function<void(std::function<void()>)>* runner = nullptr; |
| 680 | std::function<void(std::function<void()>, int64)>* cost_runner = nullptr; |
| 681 | |
| 682 | // Parameters for remote function execution. |
| 683 | bool remote_execution = false; |
| 684 | string source_device = ""; // Fully specified device name. |
| 685 | |
| 686 | // Allocator attributes specifying where the args are / rets should be put. |
| 687 | // These should either be {} or match the length of args / retvals. If {}, |
| 688 | // the default allocator attributes will be assumed for all args / retvals. |
| 689 | std::vector<AllocatorAttributes> args_alloc_attrs; |
| 690 | std::vector<AllocatorAttributes> rets_alloc_attrs; |
| 691 | |
| 692 | // If true, we create a new IntraProcessRendezvous, else use the existing |
| 693 | // one. |
| 694 | bool create_rendezvous = false; |
| 695 | |
| 696 | // If True, allow returning dead tensors. |
| 697 | bool allow_dead_tensors = false; |
| 698 | |
| 699 | // Returns a human readable representation of this. |
| 700 | string DebugString() const; |
| 701 | }; |
| 702 | typedef std::function<void(const Status&)> DoneCallback; |
| 703 | virtual void Run(const Options& opts, Handle handle, |
| 704 | gtl::ArraySlice<Tensor> args, std::vector<Tensor>* rets, |