ArmNN
 24.02
DeviceSpec.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include <armnn/Types.hpp>
8 #include <set>
9 #include <vector>
10 
11 namespace armnn
12 {
13 
14 class DeviceSpec : public IDeviceSpec
15 {
16 public:
18  {}
19 
20  DeviceSpec(const BackendIdSet& supportedBackends)
21  : m_SupportedBackends{supportedBackends} {}
22 
23  virtual ~DeviceSpec() {}
24 
25  virtual const BackendIdSet& GetSupportedBackends() const override
26  {
27  return m_SupportedBackends;
28  }
29 
30  void AddSupportedBackends(const BackendIdSet& backendIds, bool isDynamic = false)
31  {
32  m_SupportedBackends.insert(backendIds.begin(), backendIds.end());
33  if (isDynamic)
34  {
35  m_DynamicBackends.insert(backendIds.begin(), backendIds.end());
36  }
37  }
38 
40  {
41  for (const auto& id : m_DynamicBackends)
42  {
43  m_SupportedBackends.erase(id);
44  }
45  m_DynamicBackends.clear();
46  }
47 
49  {
50  return m_DynamicBackends;
51  }
52 
53 private:
54  BackendIdSet m_SupportedBackends;
55  BackendIdSet m_DynamicBackends;
56 };
57 
58 } // namespace armnn
armnn::DeviceSpec::AddSupportedBackends
void AddSupportedBackends(const BackendIdSet &backendIds, bool isDynamic=false)
Definition: DeviceSpec.hpp:30
armnn::DeviceSpec::DeviceSpec
DeviceSpec()
Definition: DeviceSpec.hpp:17
armnn::DeviceSpec::GetDynamicBackends
const BackendIdSet & GetDynamicBackends() const
Definition: DeviceSpec.hpp:48
armnn::BackendIdSet
std::unordered_set< BackendId > BackendIdSet
Definition: BackendId.hpp:193
armnn::DeviceSpec::ClearDynamicBackends
void ClearDynamicBackends()
Definition: DeviceSpec.hpp:39
armnn::DeviceSpec::~DeviceSpec
virtual ~DeviceSpec()
Definition: DeviceSpec.hpp:23
armnn::DeviceSpec
Definition: DeviceSpec.hpp:14
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
Types.hpp
armnn::IDeviceSpec
Device specific knowledge to be passed to the optimizer.
Definition: Types.hpp:299
armnn::DeviceSpec::GetSupportedBackends
virtual const BackendIdSet & GetSupportedBackends() const override
Definition: DeviceSpec.hpp:25
armnn::DeviceSpec::DeviceSpec
DeviceSpec(const BackendIdSet &supportedBackends)
Definition: DeviceSpec.hpp:20