diff --git a/runtime/onert/core/include/backend/basic/BackendContextHelpers.h b/runtime/onert/core/include/backend/basic/BackendContextHelpers.h index 0e3b9776354..9238c7d70e3 100644 --- a/runtime/onert/core/include/backend/basic/BackendContextHelpers.h +++ b/runtime/onert/core/include/backend/basic/BackendContextHelpers.h @@ -184,7 +184,8 @@ template ITensorRegistry *genTensors(T_BackendContex // process source tensors for shared memory at first std::vector registered_source_ind; - for(const auto& [_, source_ind] : tensor_builder->getOperandsWithSharedMemory()) { + for (const auto &[_, source_ind] : tensor_builder->getOperandsWithSharedMemory()) + { if (ctx.external_operands().contains(source_ind)) continue; tensor_builder->registerTensorInfo(source_ind, graph.operands().at(source_ind).info()); @@ -194,7 +195,8 @@ template ITensorRegistry *genTensors(T_BackendContex graph.operands().iterate([&](const ir::OperandIndex &ind, const ir::Operand &obj) { if (ctx.external_operands().contains(ind)) return; - if(std::find(std::begin(registered_source_ind), std::end(registered_source_ind), ind) != std::end(registered_source_ind)) // skip tensors already registered + if (std::find(std::begin(registered_source_ind), std::end(registered_source_ind), ind) != + std::end(registered_source_ind)) // skip tensors already registered return; tensor_builder->registerTensorInfo(ind, obj.info()); }); diff --git a/runtime/onert/core/include/backend/basic/TensorBuilder.h b/runtime/onert/core/include/backend/basic/TensorBuilder.h index 3f259d968bc..4024e239569 100644 --- a/runtime/onert/core/include/backend/basic/TensorBuilder.h +++ b/runtime/onert/core/include/backend/basic/TensorBuilder.h @@ -56,7 +56,7 @@ class TensorBuilder void allocate(void); - const ir::OperandIndexMap& getOperandsWithSharedMemory() const; + const ir::OperandIndexMap &getOperandsWithSharedMemory() const; DynamicTensorManager *dynamicTensorManager(void) { return _dynamic_tensor_mgr.get(); } diff --git a/runtime/onert/core/src/backend/basic/TensorBuilder.cc b/runtime/onert/core/src/backend/basic/TensorBuilder.cc index 10d33cf3667..9cdf5b3f93f 100644 --- a/runtime/onert/core/src/backend/basic/TensorBuilder.cc +++ b/runtime/onert/core/src/backend/basic/TensorBuilder.cc @@ -33,7 +33,7 @@ TensorBuilder::TensorBuilder( : _tensor_reg{tensor_reg}, _dynamic_tensor_mgr{new DynamicTensorManager(_tensor_reg)}, _static_tensor_mgr{ new StaticTensorManager(_tensor_reg, _dynamic_tensor_mgr.get(), operands_with_shared_memory)}, - _operands_with_shared_memory{operands_with_shared_memory} + _operands_with_shared_memory{operands_with_shared_memory} { /* empty */ } @@ -89,7 +89,8 @@ bool TensorBuilder::isRegistered(const ir::OperandIndex &ind) const void TensorBuilder::allocate(void) { _static_tensor_mgr->allocateNonconsts(); } -const ir::OperandIndexMap& TensorBuilder::getOperandsWithSharedMemory() const { +const ir::OperandIndexMap &TensorBuilder::getOperandsWithSharedMemory() const +{ return _operands_with_shared_memory; } diff --git a/runtime/onert/core/src/backend/builtin/TensorBuilder.cc b/runtime/onert/core/src/backend/builtin/TensorBuilder.cc index 4fe2cd18635..114ec84b8d9 100644 --- a/runtime/onert/core/src/backend/builtin/TensorBuilder.cc +++ b/runtime/onert/core/src/backend/builtin/TensorBuilder.cc @@ -102,7 +102,8 @@ basic::Tensor *TensorBuilder::nativeOwnTensorAt(const ir::OperandIndex &ind) return _tensor_reg->getNativeOwnTensor(ind); } -const ir::OperandIndexMap& TensorBuilder::getOperandsWithSharedMemory() const { +const ir::OperandIndexMap &TensorBuilder::getOperandsWithSharedMemory() const +{ return _operands_with_shared_memory; } diff --git a/runtime/onert/core/src/backend/builtin/TensorBuilder.h b/runtime/onert/core/src/backend/builtin/TensorBuilder.h index 98fea6a0623..129ff6e6e5d 100644 --- a/runtime/onert/core/src/backend/builtin/TensorBuilder.h +++ b/runtime/onert/core/src/backend/builtin/TensorBuilder.h @@ -54,7 +54,7 @@ class TensorBuilder void allocate(void); - const ir::OperandIndexMap& getOperandsWithSharedMemory() const; + const ir::OperandIndexMap &getOperandsWithSharedMemory() const; DynamicTensorManager *dynamicTensorManager(void); diff --git a/tests/nnfw_api/lib/CircleGen.cc b/tests/nnfw_api/lib/CircleGen.cc index 763a5ca46cf..ad1311c0e5f 100644 --- a/tests/nnfw_api/lib/CircleGen.cc +++ b/tests/nnfw_api/lib/CircleGen.cc @@ -582,7 +582,8 @@ uint32_t CircleGen::addOperatorSquare(const OperatorParams ¶ms) circle::BuiltinOptions_SquareOptions, options); } -uint32_t CircleGen::addOperatorSqueeze(const OperatorParams ¶ms, const std::vector& squeeze_dims) +uint32_t CircleGen::addOperatorSqueeze(const OperatorParams ¶ms, + const std::vector &squeeze_dims) { auto squeeze_dims_vec = _fbb.CreateVector(squeeze_dims.data(), squeeze_dims.size()); auto options = circle::CreateSqueezeOptions(_fbb, squeeze_dims_vec).Union(); diff --git a/tests/nnfw_api/lib/CircleGen.h b/tests/nnfw_api/lib/CircleGen.h index 507e472445f..0fd48e64bd0 100644 --- a/tests/nnfw_api/lib/CircleGen.h +++ b/tests/nnfw_api/lib/CircleGen.h @@ -221,7 +221,8 @@ class CircleGen uint32_t addOperatorSplit(const OperatorParams ¶ms, int32_t num_split); uint32_t addOperatorSqrt(const OperatorParams ¶ms); uint32_t addOperatorSquare(const OperatorParams ¶ms); - uint32_t addOperatorSqueeze(const OperatorParams ¶ms, const std::vector& squeeze_dims); + uint32_t addOperatorSqueeze(const OperatorParams ¶ms, + const std::vector &squeeze_dims); uint32_t addOperatorStridedSlice(const OperatorParams ¶ms, int32_t begin_mask = 0, int32_t end_mask = 0, int32_t ellipsis_mask = 0, int32_t new_axis_mask = 0, int32_t shrink_axis_mask = 0); diff --git a/tests/nnfw_api/src/GenModelTests/MemorySharingModels.test.cc b/tests/nnfw_api/src/GenModelTests/MemorySharingModels.test.cc index 9ca82569c5e..d2436a61f4b 100644 --- a/tests/nnfw_api/src/GenModelTests/MemorySharingModels.test.cc +++ b/tests/nnfw_api/src/GenModelTests/MemorySharingModels.test.cc @@ -38,7 +38,8 @@ TEST_F(GenModelTest, OptimizedReshapeInferenceSuccessfully) cgen.setInputsAndOutputs({input}, {cos2_out}); _context = std::make_unique(cgen.finish()); - _context->addTestCase(uniformTCD({{1, 2, 3, 4}}, {{0.85755322, 0.91465333, 0.54869613, 0.79387345}})); + _context->addTestCase( + uniformTCD({{1, 2, 3, 4}}, {{0.85755322, 0.91465333, 0.54869613, 0.79387345}})); _context->setBackends({"cpu"}); SUCCEED(); @@ -61,7 +62,8 @@ TEST_F(GenModelTest, OptimizedExpandDimsInferenceSuccessfully) cgen.setInputsAndOutputs({input}, {cos2_out}); _context = std::make_unique(cgen.finish()); - _context->addTestCase(uniformTCD({{1, 2, 3, 4}}, {{0.85755322, 0.91465333, 0.54869613, 0.79387345}})); + _context->addTestCase( + uniformTCD({{1, 2, 3, 4}}, {{0.85755322, 0.91465333, 0.54869613, 0.79387345}})); _context->setBackends({"cpu"}); SUCCEED(); @@ -84,7 +86,8 @@ TEST_F(GenModelTest, OptimizedReshapeConstInput) cgen.setInputsAndOutputs({}, {cos_out}); _context = std::make_unique(cgen.finish()); - _context->addTestCase(uniformTCD({}, {{0.54030231, -0.41614684, -0.9899925, -0.65364362}})); + _context->addTestCase( + uniformTCD({}, {{0.54030231, -0.41614684, -0.9899925, -0.65364362}})); _context->setBackends({"cpu"}); SUCCEED(); @@ -100,10 +103,10 @@ TEST_F(GenModelTest, OptimizedReshapeDynOutput) int cast2_out = cgen.addTensor({{2, 2}, circle::TensorType::TensorType_INT32}); cgen.addOperatorCast({{cast_in}, {cast_out}}, circle::TensorType::TensorType_INT32, - circle::TensorType::TensorType_FLOAT32); + circle::TensorType::TensorType_FLOAT32); cgen.addOperatorReshape({{cast_out, new_shape}, {reshape_out}}); cgen.addOperatorCast({{reshape_out}, {cast2_out}}, circle::TensorType::TensorType_FLOAT32, - circle::TensorType::TensorType_INT32); + circle::TensorType::TensorType_INT32); cgen.setInputsAndOutputs({cast_in, new_shape}, {cast2_out}); _context = std::make_unique(cgen.finish()); @@ -128,7 +131,8 @@ TEST_F(GenModelTest, OptimizedSqueezeInferenceSuccessfully) cgen.setInputsAndOutputs({input}, {cos2_out}); _context = std::make_unique(cgen.finish()); - _context->addTestCase(uniformTCD({{1, 2, 3, 4}}, {{0.85755322, 0.91465333, 0.54869613, 0.79387345}})); + _context->addTestCase( + uniformTCD({{1, 2, 3, 4}}, {{0.85755322, 0.91465333, 0.54869613, 0.79387345}})); _context->setBackends({"cpu"}); SUCCEED(); @@ -171,7 +175,9 @@ TEST_F(GenModelTest, ReshapeInputModelOutput) cgen.setInputsAndOutputs({input}, {cos1_out, cos2_out}); _context = std::make_unique(cgen.finish()); - _context->addTestCase(uniformTCD({{1, 2, 3, 4}}, {{0.54030231, -0.41614684, -0.9899925, -0.65364362}, {0.85755322, 0.91465333, 0.54869613, 0.79387345}})); + _context->addTestCase( + uniformTCD({{1, 2, 3, 4}}, {{0.54030231, -0.41614684, -0.9899925, -0.65364362}, + {0.85755322, 0.91465333, 0.54869613, 0.79387345}})); _context->setBackends({"cpu"}); SUCCEED(); @@ -192,9 +198,9 @@ TEST_F(GenModelTest, ReshapeOutputModelOutput) cgen.setInputsAndOutputs({input}, {reshape_out}); _context = std::make_unique(cgen.finish()); - _context->addTestCase(uniformTCD({{1, 2, 3, 4}}, {{0.54030231, -0.41614684, -0.9899925, -0.65364362}})); + _context->addTestCase( + uniformTCD({{1, 2, 3, 4}}, {{0.54030231, -0.41614684, -0.9899925, -0.65364362}})); _context->setBackends({"cpu"}); SUCCEED(); } -