ArmNN
 24.08
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::StrategyBase::m_DefaultStrategy
DefaultStrategy m_DefaultStrategy
Definition: StrategyBase.hpp:50
armnn::StrategyBase
Strategy base class with empty implementations.
Definition: StrategyBase.hpp:27
armnn::GetLayerTypeAsCString
const char * GetLayerTypeAsCString(LayerType type)
Definition: InternalTypes.cpp:13
IgnoreUnused.hpp
armnn::IStrategy
Definition: IStrategy.hpp:16
armnn::ThrowingStrategy
Definition: StrategyBase.hpp:15
INetwork.hpp
armnn::LayerBindingId
int LayerBindingId
Type of identifiers for bindable layers (inputs, outputs).
Definition: Types.hpp:309
armnn::ThrowingStrategy::Apply
void Apply(const std::string &errorMessage="")
Definition: StrategyBase.hpp:17
armnn::NoThrowStrategy
Definition: StrategyBase.hpp:20
armnn::IConnectableLayer::GetType
virtual LayerType GetType() const =0
Returns the armnn::LayerType of this layer.
armnn::BaseDescriptor
Base class for all descriptors.
Definition: Descriptors.hpp:22
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
armnn::IgnoreUnused
void IgnoreUnused(Ts &&...)
Definition: IgnoreUnused.hpp:14
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::StrategyBase::~StrategyBase
virtual ~StrategyBase()
Definition: StrategyBase.hpp:30
armnn::IConnectableLayer
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:80
armnn::UnimplementedException
Definition: Exceptions.hpp:98
armnn::NoThrowStrategy::Apply
void Apply(const std::string &)
Definition: StrategyBase.hpp:22