ArmNN
 25.02
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
FusedLayer(const FusedDescriptor &param, const char *name)
Definition: FusedLayer.cpp:15
void ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
Definition: FusedLayer.cpp:43
void ValidateTensorShapesFromInputs() override
Definition: FusedLayer.cpp:37
FusedLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
Definition: FusedLayer.cpp:22
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Definition: FusedLayer.cpp:29
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
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.
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:332
AdditionalInfoObjectPtr m_AdditionalInfoObject
Definition: Layer.hpp:427
void SetAdditionalInfo(QueueDescriptor &descriptor) const
Definition: Layer.cpp:303
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *Layer::CreateWorkload.
FusedDescriptor m_Param
The parameters for the layer (not including tensor-valued weights etc.).
const FusedDescriptor & GetParameters() const override
Copyright (c) 2021 ARM Limited and Contributors.
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
Definition: Types.hpp:494
A FusedDescriptor for the FusedLayer.