MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / parse_model

Method parse_model

lite/src/parse_model/model_parser.cpp:105–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105std::shared_ptr<void> ModelParser::parse_model(
106 size_t& model_length, const Config& config) const {
107 if (m_is_bare_model) {
108 if (config.bare_model_cryption_name.size() == 0) {
109 model_length = m_total_length;
110 return m_model;
111 } else {
112 return decrypt_memory(
113 static_cast<uint8_t*>(m_model.get()), m_total_length,
114 config.bare_model_cryption_name, model_length);
115 }
116 }
117 LITE_ASSERT(m_model_data, "packed model parse error!");
118 model_length = m_model_data->data()->size();
119 const uint8_t* model_data = m_model_data->data()->Data();
120 LITE_ASSERT(model_length > 0, "The loaded model is of zero length.");
121 return decrypt_memory(
122 model_data, model_length, m_model_decryption_name, model_length);
123}
124
125std::shared_ptr<void> ModelParser::decrypt_memory(
126 const uint8_t* data, size_t length, const std::string decryption_name,

Callers 1

prase_modelMethod · 0.80

Calls 3

sizeMethod · 0.45
getMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected