| 43 | using op_load_t = std::function<bool(LiteNode* node, LiteGraph* lite_graph, StaticGraph* graph)>; |
| 44 | |
| 45 | bool TFLiteSerializer::LoadModel(const std::vector<std::string>& file_list, StaticGraph* graph) |
| 46 | { |
| 47 | if(file_list.size() != GetFileNum()) |
| 48 | return false; |
| 49 | |
| 50 | std::ifstream input_file; |
| 51 | |
| 52 | input_file.open(file_list[0], std::ios::binary | std::ios::in); |
| 53 | input_file.seekg(0, std::ios::end); |
| 54 | |
| 55 | int model_len = input_file.tellg(); |
| 56 | char* model_data = new char[model_len]; |
| 57 | |
| 58 | input_file.seekg(0, std::ios::beg); |
| 59 | input_file.read(model_data, model_len); |
| 60 | input_file.close(); |
| 61 | |
| 62 | SetGraphSource(graph, file_list[0]); |
| 63 | SetGraphSourceFormat(graph, "tflite"); |
| 64 | SetGraphLayout(graph, TENGINE_LAYOUT_NHWC); |
| 65 | SetModelLayout(graph, TENGINE_LAYOUT_NHWC); |
| 66 | SetModelFormat(graph, MODEL_FORMAT_TFLITE); |
| 67 | |
| 68 | bool ret = LoadModelFromMem(model_data, model_len, graph); |
| 69 | |
| 70 | if(!ret) |
| 71 | delete[] model_data; |
| 72 | |
| 73 | return ret; |
| 74 | } |
| 75 | |
| 76 | bool TFLiteSerializer::LoadModelFromMem(char* mem_addr, int mem_size, StaticGraph* graph) |
| 77 | { |
nothing calls this directly
no test coverage detected