ArmNN
 23.05
StrategyBase.hpp
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 #pragma once
6 
7 
8 #include <armnn/INetwork.hpp>
9 #include <armnn/IStrategy.hpp>
11 
12 namespace armnn
13 {
14 
16 {
17  void Apply(const std::string& errorMessage = "") { throw UnimplementedException(errorMessage); };
18 };
19 
21 {
22  void Apply(const std::string&) {};
23 };
24 
25 /// Strategy base class with empty implementations.
26 template <typename DefaultStrategy>
27 class StrategyBase : public IStrategy
28 {
29 protected:
30  virtual ~StrategyBase() {};
31 
32 public:
33  virtual void ExecuteStrategy(const armnn::IConnectableLayer* layer,
34  const armnn::BaseDescriptor& descriptor,
35  const std::vector<armnn::ConstTensor>& constants,
36  const char* name,
37  const armnn::LayerBindingId id = 0) override
38  {
39  armnn::IgnoreUnused(descriptor, constants, id, name);
40  switch (layer->GetType())
41  {
42  default:
43  {
45  }
46  }
47  }
48 
49 protected:
50  DefaultStrategy m_DefaultStrategy;
51 
52 };
53 
54 
55 } // namespace armnn
armnn::ThrowingStrategy::Apply
void Apply(const std::string &errorMessage="")
Definition: StrategyBase.hpp:17
armnn::NoThrowStrategy
Definition: StrategyBase.hpp:20
armnn::LayerBindingId
int LayerBindingId
Type of identifiers for bindable layers (inputs, outputs).
Definition: Types.hpp:301
armnn::IConnectableLayer
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:68
armnn::NoThrowStrategy::Apply
void Apply(const std::string &)
Definition: StrategyBase.hpp:22
armnn::IgnoreUnused
void IgnoreUnused(Ts &&...)
Definition: IgnoreUnused.hpp:14
IStrategy.hpp
armnn::StrategyBase::ExecuteStrategy
virtual void ExecuteStrategy(const armnn::IConnectableLayer *layer, const armnn::BaseDescriptor &descriptor, const std::vector< armnn::ConstTensor > &constants, const char *name, const armnn::LayerBindingId id=0) override
Definition: StrategyBase.hpp:33
INetwork.hpp
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::IStrategy
Definition: IStrategy.hpp:16
armnn::UnimplementedException
Definition: Exceptions.hpp:98
armnn::StrategyBase
Strategy base class with empty implementations.
Definition: StrategyBase.hpp:27
armnn::StrategyBase::m_DefaultStrategy
DefaultStrategy m_DefaultStrategy
Definition: StrategyBase.hpp:50
armnn::BaseDescriptor
Base class for all descriptors.
Definition: Descriptors.hpp:22
armnn::ThrowingStrategy
Definition: StrategyBase.hpp:15
armnn::StrategyBase::~StrategyBase
virtual ~StrategyBase()
Definition: StrategyBase.hpp:30
armnn::IConnectableLayer::GetType
virtual LayerType GetType() const =0
Returns the armnn::LayerType of this layer.
IgnoreUnused.hpp
armnn::GetLayerTypeAsCString
const char * GetLayerTypeAsCString(LayerType type)
Definition: InternalTypes.cpp:13