ArmNN
 22.02
MapLayer.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020 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.
42 }
43 
45 void MapLayer::Accept(ILayerVisitor& visitor) const
46 {
47  IgnoreUnused(visitor);
48  throw armnn::Exception("MapLayer should not appear in an input graph");
49 }
51 
52 } // namespace armnn
#define ARMNN_NO_DEPRECATE_WARN_BEGIN
Definition: Deprecated.hpp:33
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of MapLayer.
Definition: MapLayer.cpp:37
Copyright (c) 2021 ARM Limited and Contributors.
void IgnoreUnused(Ts &&...)
unsigned int GetNumOutputSlots() const override
Returns the number of connectable output slots.
Definition: Layer.hpp:319
MapLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
Definition: MapLayer.cpp:22
This layer represents a memory copy operation.
Definition: MapLayer.hpp:13
void VerifyLayerConnections(unsigned int expectedConnections, const CheckLocation &location) const
Definition: Layer.cpp:352
#define ARMNN_NO_DEPRECATE_WARN_END
Definition: Deprecated.hpp:34
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *LayerCreateWorkload.
Definition: Layer.hpp:388
MapLayer(const char *name)
Constructor to create a MapLayer.
Definition: MapLayer.cpp:17
ARMNN_NO_DEPRECATE_WARN_BEGIN void Accept(ILayerVisitor &visitor) const override
Definition: MapLayer.cpp:45
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
#define CHECK_LOCATION()
Definition: Exceptions.hpp:209
void SetAdditionalInfo(QueueDescriptor &descriptor) const
Definition: Layer.cpp:248
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the Map type.
Definition: MapLayer.cpp:27
Base class for all ArmNN exceptions so that users can filter to just those.
Definition: Exceptions.hpp:46
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:316
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below...
Definition: Types.hpp:458