ArmNN  NotReleased
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
DeviceSpec(const BackendIdSet &supportedBackends)
Definition: DeviceSpec.hpp:20
virtual ~DeviceSpec()
Definition: DeviceSpec.hpp:23
void ClearDynamicBackends()
Definition: DeviceSpec.hpp:39
virtual const BackendIdSet & GetSupportedBackends() const override
Definition: DeviceSpec.hpp:25
void AddSupportedBackends(const BackendIdSet &backendIds, bool isDynamic=false)
Definition: DeviceSpec.hpp:30
const BackendIdSet & GetDynamicBackends() const
Definition: DeviceSpec.hpp:48
std::unordered_set< BackendId > BackendIdSet
Definition: BackendId.hpp:191
Device specific knowledge to be passed to the optimizer.
Definition: Types.hpp:158