| 2157 | : session(s), graph(g), last_num_graph_nodes(0), extend_before_run(true) {} |
| 2158 | |
| 2159 | TF_Session* TF_NewSession(TF_Graph* graph, const TF_SessionOptions* opt, |
| 2160 | TF_Status* status) { |
| 2161 | Session* session; |
| 2162 | status->status = NewSession(opt->options, &session); |
| 2163 | if (TF_GetCode(status) == TF_OK) { |
| 2164 | TF_Session* new_session = new TF_Session(session, graph); |
| 2165 | if (graph != nullptr) { |
| 2166 | mutex_lock l(graph->mu); |
| 2167 | graph->sessions[new_session] = ""; |
| 2168 | } |
| 2169 | return new_session; |
| 2170 | } else { |
| 2171 | DCHECK_EQ(nullptr, session); |
| 2172 | return nullptr; |
| 2173 | } |
| 2174 | } |
| 2175 | |
| 2176 | TF_Session* TF_LoadSessionFromSavedModel( |
| 2177 | const TF_SessionOptions* session_options, const TF_Buffer* run_options, |