| 981 | } |
| 982 | |
| 983 | Status DirectSession::ExtendLocked(GraphDef graph) { |
| 984 | if (!(flib_def_ && execution_state_)) { |
| 985 | // If this is the first call, we can initialize the execution state |
| 986 | // with `graph` and do not need to call `Extend()`. |
| 987 | // NOTE(mrry): The function library created here will be used for |
| 988 | // all subsequent extensions of the graph. |
| 989 | flib_def_.reset( |
| 990 | new FunctionLibraryDefinition(OpRegistry::Global(), graph.library())); |
| 991 | GraphExecutionStateOptions options; |
| 992 | options.device_set = &device_set_; |
| 993 | options.session_options = &options_; |
| 994 | options.session_handle = session_handle_; |
| 995 | TF_RETURN_IF_ERROR(GraphExecutionState::MakeForBaseGraph( |
| 996 | std::move(graph), options, &execution_state_)); |
| 997 | graph_created_ = true; |
| 998 | } else { |
| 999 | TF_RETURN_IF_ERROR(flib_def_->AddLibrary(graph.library())); |
| 1000 | std::unique_ptr<GraphExecutionState> state; |
| 1001 | // TODO(mrry): Rewrite GraphExecutionState::Extend() to take `graph` by |
| 1002 | // value and move `graph` in here. |
| 1003 | TF_RETURN_IF_ERROR(execution_state_->Extend(graph, &state)); |
| 1004 | execution_state_.swap(state); |
| 1005 | } |
| 1006 | return Status::OK(); |
| 1007 | } |
| 1008 | |
| 1009 | Status DirectSession::Run(const NamedTensorList& inputs, |
| 1010 | const std::vector<string>& output_names, |
nothing calls this directly
no test coverage detected