Set server_def on the context, possibly updating it.
| 425 | |
| 426 | // Set server_def on the context, possibly updating it. |
| 427 | TF_CAPI_EXPORT extern void TFE_ContextSetServerDef(TFE_Context* ctx, |
| 428 | int keep_alive_secs, |
| 429 | const void* proto, |
| 430 | size_t proto_len, |
| 431 | TF_Status* status) { |
| 432 | #if defined(IS_MOBILE_PLATFORM) |
| 433 | status->status = tensorflow::errors::Unimplemented( |
| 434 | "TFE_ContextSetServerDef not supported on mobile"); |
| 435 | #else // !defined(IS_MOBILE_PLATFORM) |
| 436 | tensorflow::ServerDef server_def; |
| 437 | if (!server_def.ParseFromArray(proto, proto_len)) { |
| 438 | status->status = tensorflow::errors::InvalidArgument( |
| 439 | "Invalid tensorflow.ServerDef protocol buffer"); |
| 440 | return; |
| 441 | } |
| 442 | status->status = |
| 443 | UpdateTFE_ContextWithServerDef(keep_alive_secs, server_def, ctx); |
| 444 | #endif // !IS_MOBILE_PLATFORM |
| 445 | } |
| 446 | |
| 447 | void TFE_ContextSetThreadLocalDevicePlacementPolicy( |
| 448 | TFE_Context* ctx, TFE_ContextDevicePlacementPolicy policy) { |