| 705 | } |
| 706 | |
| 707 | bool TmSerializer2::LoadModelFromMem(void* mmap_buf, StaticGraph* graph) |
| 708 | { |
| 709 | const TM2_Header* tm_header = reinterpret_cast<const TM2_Header*>(mmap_buf); |
| 710 | |
| 711 | const TM2_Model* tm_model = GetTmPtr<TM2_Model>(mmap_buf, tm_header->offset_root); |
| 712 | |
| 713 | /* Load dla tengine model */ |
| 714 | // if(tm_model->orig_format == MODEL_FORMAT_DLA) |
| 715 | // return LoadDlaModel(mmap_buf, graph); |
| 716 | |
| 717 | if(tm_model->offset_s_mname == TM2_NOT_SET) |
| 718 | { |
| 719 | SetGraphIdentity(graph, "tengine", "tengine_model", "0"); |
| 720 | } |
| 721 | else |
| 722 | { |
| 723 | std::string tm_model_name; |
| 724 | const TM2_String* tm_str = GetTmPtr<TM2_String>(mmap_buf, tm_model->offset_s_mname); |
| 725 | tm_model_name.assign(GetTmPtr<char>(mmap_buf, tm_str->offset_data), tm_str->size - 1); |
| 726 | SetGraphIdentity(graph, "tengine", tm_model_name, "0"); |
| 727 | } |
| 728 | |
| 729 | SetModelFormat(graph, tm_model->orig_format); |
| 730 | |
| 731 | if(LoadGraph(graph, tm_model, mmap_buf)) |
| 732 | return true; |
| 733 | else |
| 734 | return false; |
| 735 | } |
| 736 | |
| 737 | bool TmSerializerRegisterOpLoader2(void) |
| 738 | { |
no test coverage detected