ArmNN
 21.11
TestStrategy.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "TestStrategy.hpp"
7 
8 namespace armnn
9 {
10 
11  std::string TestStrategy::GetName() const
12  {
13  return m_Name;
14  }
15 
17  {
18  return m_MemBlockStrategyType;
19  }
20 
21  // A IMemoryOptimizerStrategy must ensure that
22  // 1: All MemBlocks have been assigned to a MemBin
23  // 2: No MemBlock is assigned to multiple MemBins
24  // 3: No two Memblocks in a MemBin overlap in both the X and Y axis
25  std::vector<MemBin> TestStrategy::Optimize(std::vector<MemBlock>& memBlocks)
26  {
27  std::vector<MemBin> memBins;
28  memBins.reserve(memBlocks.size());
29 
30  for (auto& memBlock : memBlocks)
31  {
32  MemBin memBin;
33  memBin.m_MemSize = memBlock.m_MemSize;
34  memBin.m_MemBlocks.reserve(1);
35  memBlock.m_Offset = 0;
36  memBin.m_MemBlocks.push_back(memBlock);
37  memBins.push_back(memBin);
38  }
39 
40  return memBins;
41  }
42 
43 } // namespace armnn
std::vector< MemBin > Optimize(std::vector< MemBlock > &memBlocks) override
std::vector< MemBlock > m_MemBlocks
Copyright (c) 2021 ARM Limited and Contributors.
MemBlockStrategyType GetMemBlockStrategyType() const override
MemBlockStrategyType
Definition: Types.hpp:226
std::string GetName() const override