From 8f44eb9957c90a11283df6954e43ae743e333fc1 Mon Sep 17 00:00:00 2001 From: scholar-lc <1936194231@qq.com> Date: Mon, 27 Mar 2023 17:33:01 +0800 Subject: [PATCH] =?UTF-8?q?=20=E5=8C=97=E5=90=91=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AF=B9=E7=A6=BB=E7=BA=BF=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E3=80=81=E9=94=99=E8=AF=AF=E7=A0=81=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E7=9A=84=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: scholar-lc <1936194231@qq.com> Signed-off-by: wangchuanxia Signed-off-by: scholar-lc <1936194231@qq.com> --- ai/neural_network_runtime/v2_0/common/mock_idevice.cpp | 10 ++++++++-- ai/neural_network_runtime/v2_0/common/mock_idevice.h | 5 ++++- .../v2_0/interface/src/MemoryTest.cpp | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ai/neural_network_runtime/v2_0/common/mock_idevice.cpp b/ai/neural_network_runtime/v2_0/common/mock_idevice.cpp index 457d9abde..b33576ca3 100644 --- a/ai/neural_network_runtime/v2_0/common/mock_idevice.cpp +++ b/ai/neural_network_runtime/v2_0/common/mock_idevice.cpp @@ -206,6 +206,13 @@ int32_t MockIDevice::PrepareModel(const Model& model, const ModelConfig& config, return HDF_SUCCESS; } +int32_t MockIDevice::PrepareOfflineModel(const std::vector& offlineModels, const ModelConfig& config, + sptr& preparedModel) +{ + preparedModel = new (std::nothrow) V2_0::MockIPreparedModel(); + return V2_0::NNRT_ReturnCode::NNRT_SUCCESS; +} + int32_t MockIDevice::PrepareModelFromModelCache(const std::vector& modelCache, const ModelConfig& config, sptr& preparedModel) { @@ -251,10 +258,9 @@ int32_t MockIPreparedModel::GetVersion(uint32_t &majorVersion, uint32_t &minorVe } int32_t MockIPreparedModel::Run(const std::vector& inputs, const std::vector& outputs, - std::vector>& outputsDims, std::vector& isOutputBufferEnough) + std::vector>& outputsDims) { outputsDims = {{1, 2, 2, 1}}; - isOutputBufferEnough = {true}; return HDF_SUCCESS; } diff --git a/ai/neural_network_runtime/v2_0/common/mock_idevice.h b/ai/neural_network_runtime/v2_0/common/mock_idevice.h index 93acc8b16..83739d9b9 100644 --- a/ai/neural_network_runtime/v2_0/common/mock_idevice.h +++ b/ai/neural_network_runtime/v2_0/common/mock_idevice.h @@ -70,6 +70,9 @@ public: int32_t PrepareModel(const Model& model, const ModelConfig& config, sptr& preparedModel) override; + int32_t PrepareOfflineModel(const std::vector& offlineModels, const ModelConfig& config, + sptr& preparedModel) override; + int32_t PrepareModelFromModelCache(const std::vector& modelCache, const ModelConfig& config, sptr& preparedModel) override; @@ -108,7 +111,7 @@ class MockIPreparedModel : public IPreparedModel { public: int32_t ExportModelCache(std::vector& modelCache) override; int32_t Run(const std::vector& inputs, const std::vector& outputs, - std::vector>& outputsDims, std::vector& isOutputBufferEnough) override; + std::vector>& outputsDims) override; int32_t GetInputDimRanges(std::vector>& minInputDims, std::vector>& maxInputDims) override; int32_t GetVersion(uint32_t &majorVersion, uint32_t &minorVersion) override; MockIPreparedModel() = default; diff --git a/ai/neural_network_runtime/v2_0/interface/src/MemoryTest.cpp b/ai/neural_network_runtime/v2_0/interface/src/MemoryTest.cpp index 1fb82b66f..ae19874c5 100644 --- a/ai/neural_network_runtime/v2_0/interface/src/MemoryTest.cpp +++ b/ai/neural_network_runtime/v2_0/interface/src/MemoryTest.cpp @@ -805,7 +805,7 @@ HWTEST_F(MemoryTest, SUB_AI_NNRt_Func_North_Executor_Memory_Run_0200, Function | OH_NNExecutor *executor = OH_NNExecutor_Construct(compilation); ASSERT_NE(nullptr, executor); uint32_t inputIndex = 0; - for (auto i = 0; i < graphArgs.operands.size(); i++) { + for (size_t i = 0; i < graphArgs.operands.size(); i++) { const OHNNOperandTest &operandTem = graphArgs.operands[i]; auto quantParam = operandTem.quantParam; OH_NN_Tensor operand = {operandTem.dataType, (uint32_t)operandTem.shape.size(), operandTem.shape.data(), -- GitLab