| 298 | } |
| 299 | |
| 300 | TF_Buffer* TFE_GetServerDef(const char* text_proto, TF_Status* status) { |
| 301 | tensorflow::ServerDef server_def; |
| 302 | if (!tensorflow::protobuf::TextFormat::ParseFromString(text_proto, |
| 303 | &server_def)) { |
| 304 | status->status = tensorflow::errors::Internal( |
| 305 | "Invalid text proto for ServerDef: ", text_proto); |
| 306 | return nullptr; |
| 307 | } |
| 308 | status->status = tensorflow::Status(); |
| 309 | TF_Buffer* ret = TF_NewBuffer(); |
| 310 | TF_CHECK_OK(MessageToBuffer(server_def, ret)); |
| 311 | return ret; |
| 312 | } |
| 313 | |
| 314 | TFE_Context* TFE_CreateContextFromSession(TF_Session* session, |
| 315 | TF_Status* status) { |