From 0b2676c608ebe08fe192d15f064a313012a4e5c3 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Wed, 27 Oct 2021 19:59:49 +0800 Subject: [PATCH] fix(lite): fix lite profile bug when using packed model with mode info GitOrigin-RevId: 707cb8834152be965124ef068399f9d1039e4dfd --- lite/src/mge/network_impl.cpp | 1 - lite/src/mge/network_impl.h | 1 + lite/test/test_common.h | 8 ++++---- lite/tools/pack_model/pack_model_and_info.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) mode change 100644 => 100755 lite/tools/pack_model/pack_model_and_info.py diff --git a/lite/src/mge/network_impl.cpp b/lite/src/mge/network_impl.cpp index e75d598ab..03c5e5a4a 100644 --- a/lite/src/mge/network_impl.cpp +++ b/lite/src/mge/network_impl.cpp @@ -44,7 +44,6 @@ LITE_DYN_TYPE_OBJ_FINAL_IMPL(NetworkImplDft); void NetworkImplDft::set_config(const Config& config) { m_user_config = std::make_unique(); *m_user_config = config; - m_load_config.comp_graph = mgb::ComputingGraph::make(); m_compnode_locator = to_compnode_locator(m_user_config->device_type); m_compnode_locator.device = config.device_id; } diff --git a/lite/src/mge/network_impl.h b/lite/src/mge/network_impl.h index 04af5f9f2..098bb7fb1 100644 --- a/lite/src/mge/network_impl.h +++ b/lite/src/mge/network_impl.h @@ -39,6 +39,7 @@ class NetworkImplDft final : public Network::NetworkImplBase { LITE_DYN_TYPE_OBJ_FINAL_DECL; public: + NetworkImplDft() { m_load_config.comp_graph = mgb::ComputingGraph::make(); } using S = megdnn::param::ExecutionPolicy::Strategy; //! set the config of the network, include: //! the inference device diff --git a/lite/test/test_common.h b/lite/test/test_common.h index 96501f899..af815de52 100644 --- a/lite/test/test_common.h +++ b/lite/test/test_common.h @@ -73,14 +73,14 @@ __attribute__((unused)) static std::shared_ptr get_input_data( std::vector stl_shape; std::vector raw; npy::LoadArrayFromNumpy(path, type_str, stl_shape, raw); - auto lite_tensor = std::make_shared(LiteDeviceType::LITE_CPU); Layout layout; layout.ndim = stl_shape.size(); const std::map type_map = { - {"f4", LiteDataType::LITE_FLOAT}, - {"i4", LiteDataType::LITE_INT}, - {"i1", LiteDataType::LITE_INT8}, + {"f4", LiteDataType::LITE_FLOAT}, {"f2", LiteDataType::LITE_HALF}, + {"i8", LiteDataType::LITE_INT64}, {"i4", LiteDataType::LITE_INT}, + {"u4", LiteDataType::LITE_UINT}, {"i2", LiteDataType::LITE_INT16}, + {"u2", LiteDataType::LITE_UINT16}, {"i1", LiteDataType::LITE_INT8}, {"u1", LiteDataType::LITE_UINT8}}; layout.shapes[0] = 1; for (size_t i = 0; i < stl_shape.size(); i++) { diff --git a/lite/tools/pack_model/pack_model_and_info.py b/lite/tools/pack_model/pack_model_and_info.py old mode 100644 new mode 100755 index 69b697855..773ac1c09 --- a/lite/tools/pack_model/pack_model_and_info.py +++ b/lite/tools/pack_model/pack_model_and_info.py @@ -109,7 +109,7 @@ def main(): PackModel.PackModelStartModelsVector(builder, 1) builder.PrependUOffsetTRelative(model) - models = builder.EndVector(1) + models = builder.EndVector() PackModel.PackModelStart(builder) PackModel.PackModelAddModels(builder, models) -- GitLab