From 44ebfa521c26d868b172f0601f9efaacba484b92 Mon Sep 17 00:00:00 2001 From: maoyong Date: Thu, 4 Jan 2024 10:50:16 +0800 Subject: [PATCH] fix construct from cache bug Signed-off-by: maoyong --- frameworks/native/nncompiler.cpp | 21 +++++++++++++-------- frameworks/native/nncompiler.h | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/frameworks/native/nncompiler.cpp b/frameworks/native/nncompiler.cpp index 2df5226..f9c6d69 100644 --- a/frameworks/native/nncompiler.cpp +++ b/frameworks/native/nncompiler.cpp @@ -20,7 +20,6 @@ #include #include -#include "inner_model.h" #include "validation.h" #include "nncompiled_cache.h" #include "common/utils.h" @@ -122,13 +121,13 @@ NNCompiler::NNCompiler(const void* model, std::shared_ptr device, size_t { m_device = device; m_backendID = backendID; - const InnerModel* innerModel = reinterpret_cast(model); - m_liteGraph = innerModel->GetLiteGraphs(); - m_inputTensorDescs = innerModel->GetInputTensorDescs(); - m_outputTensorDescs = innerModel->GetOutputTensorDescs(); - m_metaGraph = innerModel->GetMetaGraph(); - m_quantBuffer = innerModel->GetQuantBuffer(); - m_modelName = innerModel->GetModelName(); + m_innerModel = const_cast(reinterpret_cast(model)); + m_liteGraph = m_innerModel->GetLiteGraphs(); + m_inputTensorDescs = m_innerModel->GetInputTensorDescs(); + m_outputTensorDescs = m_innerModel->GetOutputTensorDescs(); + m_metaGraph = m_innerModel->GetMetaGraph(); + m_quantBuffer = m_innerModel->GetQuantBuffer(); + m_modelName = m_innerModel->GetModelName(); } NNCompiler::~NNCompiler() @@ -279,6 +278,12 @@ OH_NN_ReturnCode NNCompiler::IsSupportedModel(const std::shared_ptr m_liteGraph {nullptr}; std::vector, OH_NN_TensorType>> m_inputTensorDescs; std::vector, OH_NN_TensorType>> m_outputTensorDescs; -- Gitee