| 501 | } |
| 502 | |
| 503 | Status ApiDefMap::LoadApiDef(const string& api_def_file_contents) { |
| 504 | const string contents = PBTxtFromMultiline(api_def_file_contents); |
| 505 | ApiDefs api_defs; |
| 506 | TF_RETURN_IF_ERROR( |
| 507 | proto_utils::ParseTextFormatFromString(contents, &api_defs)); |
| 508 | for (const auto& api_def : api_defs.op()) { |
| 509 | // Check if the op definition is loaded. If op definition is not |
| 510 | // loaded, then we just skip this ApiDef. |
| 511 | if (map_.find(api_def.graph_op_name()) != map_.end()) { |
| 512 | // Overwrite current api def with data in api_def. |
| 513 | TF_RETURN_IF_ERROR(MergeApiDefs(&map_[api_def.graph_op_name()], api_def)); |
| 514 | } |
| 515 | } |
| 516 | return Status::OK(); |
| 517 | } |
| 518 | |
| 519 | void ApiDefMap::UpdateDocs() { |
| 520 | for (auto& name_and_api_def : map_) { |