| 2425 | } |
| 2426 | |
| 2427 | TF_Buffer* TF_ApiDefMapGet(TF_ApiDefMap* api_def_map, const char* name, |
| 2428 | size_t name_len, TF_Status* status) { |
| 2429 | #if defined(IS_MOBILE_PLATFORM) || defined(IS_SLIM_BUILD) |
| 2430 | status->status = tensorflow::errors::Unimplemented( |
| 2431 | "ApiDefMap is not supported on mobile."); |
| 2432 | return nullptr; |
| 2433 | #else |
| 2434 | mutex_lock l(api_def_map->lock); |
| 2435 | if (!api_def_map->update_docs_called) { |
| 2436 | api_def_map->api_def_map.UpdateDocs(); |
| 2437 | api_def_map->update_docs_called = true; |
| 2438 | } |
| 2439 | string name_str(name, name_len); |
| 2440 | const auto* api_def = api_def_map->api_def_map.GetApiDef(name_str); |
| 2441 | if (api_def == nullptr) { |
| 2442 | return nullptr; |
| 2443 | } |
| 2444 | |
| 2445 | TF_Buffer* ret = TF_NewBuffer(); |
| 2446 | status->status = MessageToBuffer(*api_def, ret); |
| 2447 | if (TF_GetCode(status) != TF_OK) { |
| 2448 | TF_DeleteBuffer(ret); |
| 2449 | return nullptr; |
| 2450 | } |
| 2451 | return ret; |
| 2452 | #endif // defined(IS_MOBILE_PLATFORM) || defined(IS_SLIM_BUILD) |
| 2453 | } |
| 2454 | |
| 2455 | TF_Buffer* TF_GetAllRegisteredKernels(TF_Status* status) { |
| 2456 | tensorflow::KernelList kernel_list = tensorflow::GetAllRegisteredKernels(); |