ArmNN
 25.11
Loading...
Searching...
No Matches
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
12namespace armnn
13{
14
15FusedLayer::FusedLayer(const FusedDescriptor& param, const char* name)
16 : LayerWithParameters(param.m_NumInputSlots, param.m_NumOutputSlots, LayerType::Fused, param, name)
17{}
18
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
29std::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)
void ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
void ValidateTensorShapesFromInputs() override
FusedLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
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.
LayerType * CloneBase(Graph &graph, Params &&... params) const
AdditionalInfoObjectPtr m_AdditionalInfoObject
Definition Layer.hpp:430
const char * GetName() const override
Returns the name of the layer.
Definition Layer.hpp:332
void SetAdditionalInfo(QueueDescriptor &descriptor) const
Definition Layer.cpp:303
LayerWithParameters(unsigned int numInputSlots, unsigned int numOutputSlots, LayerType type, const FusedDescriptor &param, const char *name)
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
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.