ArmNN
 24.02
FusedLayer.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "FusedLayer.hpp"
7 #include "LayerCloneBase.hpp"
8 
10 #include <armnn/TypesUtils.hpp>
11 
12 namespace armnn
13 {
14 
15 FusedLayer::FusedLayer(const FusedDescriptor& param, const char* name)
16  : LayerWithParameters(param.m_NumInputSlots, param.m_NumOutputSlots, LayerType::Fused, param, name)
17 {}
18 
20 {}
21 
23 {
24  FusedLayer* clonedLayer = CloneBase<FusedLayer>(graph, m_Param, GetName());
25  clonedLayer->m_AdditionalInfoObject = const_cast<FusedLayer*>(this)->m_AdditionalInfoObject;
26  return clonedLayer;
27 }
28 
29 std::unique_ptr<IWorkload> FusedLayer::CreateWorkload(const armnn::IWorkloadFactory& factory) const
30 {
31  FusedQueueDescriptor descriptor;
32  SetAdditionalInfo(descriptor);
33 
34  return factory.CreateWorkload(LayerType::Fused, descriptor, PrepInfoAndDesc(descriptor));
35 }
36 
38 {
39  // NOTE: since the FusedLayer is an internal layer created from a valid SubgraphView,
40  // we do not need to validate its input shapes
41 }
42 
44 {
45  strategy.ExecuteStrategy(this, GetParameters(), {}, GetName());
46 }
47 
48 } // namespace armnn
armnn::Layer::m_AdditionalInfoObject
AdditionalInfoObjectPtr m_AdditionalInfoObject
Definition: Layer.hpp:427
TypesUtils.hpp
armnn::FusedLayer
Definition: FusedLayer.hpp:19
armnn::FusedLayer::ExecuteStrategy
void ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
Definition: FusedLayer.cpp:43
armnn::FusedQueueDescriptor
Definition: WorkloadData.hpp:185
armnn::IStrategy
Definition: IStrategy.hpp:16
FusedLayer.hpp
armnn::LayerWithParameters< FusedDescriptor >::GetParameters
const FusedDescriptor & GetParameters() const override
Definition: LayerWithParameters.hpp:19
armnn::LayerWithParameters
Definition: LayerWithParameters.hpp:14
armnn::Layer::GetName
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:332
armnn::FusedDescriptor
A FusedDescriptor for the FusedLayer.
Definition: Descriptors.hpp:944
armnn::LayerWithParameters< FusedDescriptor >::m_Param
FusedDescriptor m_Param
The parameters for the layer (not including tensor-valued weights etc.).
Definition: LayerWithParameters.hpp:52
armnn::FusedLayer::CreateWorkload
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Definition: FusedLayer.cpp:29
armnn::LayerWithParameters< FusedDescriptor >::PrepInfoAndDesc
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *Layer::CreateWorkload.
Definition: LayerWithParameters.hpp:44
Workload.hpp
armnn::IWorkloadFactory
Definition: WorkloadFactory.hpp:22
armnn::FusedLayer::~FusedLayer
~FusedLayer()
Definition: FusedLayer.cpp:19
armnn::Layer::SetAdditionalInfo
void SetAdditionalInfo(QueueDescriptor &descriptor) const
Definition: Layer.cpp:287
armnn::FusedLayer::Clone
FusedLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
Definition: FusedLayer.cpp:22
armnn::FusedLayer::FusedLayer
FusedLayer(const FusedDescriptor &param, const char *name)
Definition: FusedLayer.cpp:15
armnn::LayerType::Fused
@ Fused
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::FusedLayer::ValidateTensorShapesFromInputs
void ValidateTensorShapesFromInputs() override
Definition: FusedLayer.cpp:37
armnn::LayerType
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
Definition: Types.hpp:491
armnn::Graph
Definition: Graph.hpp:30
armnn::IWorkloadFactory::CreateWorkload
virtual std::unique_ptr< IWorkload > CreateWorkload(LayerType type, const QueueDescriptor &descriptor, const WorkloadInfo &info) const =0
Backends should implement their own CreateWorkload function with a switch statement.
armnn::IStrategy::ExecuteStrategy
virtual void ExecuteStrategy(const IConnectableLayer *layer, const armnn::BaseDescriptor &descriptor, const std::vector< armnn::ConstTensor > &constants, const char *name, const armnn::LayerBindingId id=0)=0
LayerCloneBase.hpp