ArmNN
 24.08
MapLayer.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020,2024 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #include "MapLayer.hpp"
6 
7 #include "LayerCloneBase.hpp"
8 
9 #include <armnn/TypesUtils.hpp>
13 
14 namespace armnn
15 {
16 
17 MapLayer::MapLayer(const char* name)
18  : Layer(1, 0, LayerType::Map, name)
19 {
20 }
21 
23 {
24  return CloneBase<MapLayer>(graph, GetName());
25 }
26 
27 std::unique_ptr<IWorkload> MapLayer::CreateWorkload(const IWorkloadFactory& factory) const
28 {
29  IgnoreUnused(factory);
30  MapQueueDescriptor descriptor;
31  SetAdditionalInfo(descriptor);
32 
33  //This is different from other workloads. Does not get created by the workload factory.
34  return std::make_unique<MapWorkload>(descriptor, PrepInfoAndDesc(descriptor));
35 }
36 
38 {
39  // validates that the input is connected.
41  if (GetNumOutputSlots() != 0)
42  {
43  throw armnn::LayerValidationException("Output slots must be \"0\" - currently \""
44  + std::to_string(GetNumOutputSlots()) + "\".");
45  }
46 }
47 
48 void MapLayer::ExecuteStrategy(IStrategy& strategy) const
49 {
50  IgnoreUnused(strategy);
51  throw armnn::Exception("MapLayer should not appear in an input graph");
52 }
53 
54 } // namespace armnn
armnn::MapQueueDescriptor
Definition: WorkloadData.hpp:76
WorkloadData.hpp
armnn::MapLayer::MapLayer
MapLayer(const char *name)
Constructor to create a MapLayer.
Definition: MapLayer.cpp:17
TypesUtils.hpp
armnn::MapLayer::ExecuteStrategy
void ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
Definition: MapLayer.cpp:48
MapLayer.hpp
CHECK_LOCATION
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203
armnn::IStrategy
Definition: IStrategy.hpp:16
WorkloadFactory.hpp
armnn::Layer::GetName
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:332
armnn::MapLayer
This layer represents a memory copy operation.
Definition: MapLayer.hpp:13
armnn::Layer
Definition: Layer.hpp:230
armnn::Layer::PrepInfoAndDesc
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *Layer::CreateWorkload.
Definition: Layer.hpp:409
armnn::LayerValidationException
Definition: Exceptions.hpp:105
armnn::IWorkloadFactory
Definition: WorkloadFactory.hpp:22
armnn::Layer::GetNumOutputSlots
unsigned int GetNumOutputSlots() const override
Returns the number of connectable output slots.
Definition: Layer.hpp:335
armnn::Layer::SetAdditionalInfo
void SetAdditionalInfo(QueueDescriptor &descriptor) const
Definition: Layer.cpp:303
armnn::Exception
Base class for all ArmNN exceptions so that users can filter to just those.
Definition: Exceptions.hpp:46
armnn::MapLayer::CreateWorkload
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the Map type.
Definition: MapLayer.cpp:27
armnn::IgnoreUnused
void IgnoreUnused(Ts &&...)
Definition: IgnoreUnused.hpp:14
armnn::MapLayer::ValidateTensorShapesFromInputs
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of MapLayer.
Definition: MapLayer.cpp:37
armnn::LayerType::Map
@ Map
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::Layer::VerifyLayerConnections
void VerifyLayerConnections(unsigned int expectedConnections, const CheckLocation &location) const
Definition: Layer.cpp:410
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
LayerCloneBase.hpp
armnn::MapLayer::Clone
MapLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
Definition: MapLayer.cpp:22
MapWorkload.hpp