• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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>
10 #include <armnn/backends/WorkloadData.hpp>
11 #include <armnn/backends/WorkloadFactory.hpp>
12 #include <backendsCommon/MapWorkload.hpp>
13 
14 namespace armnn
15 {
16 
MapLayer(const char * name)17 MapLayer::MapLayer(const char* name)
18     : Layer(1, 0, LayerType::Map, name)
19 {
20 }
21 
Clone(Graph & graph) const22 MapLayer* MapLayer::Clone(Graph& graph) const
23 {
24     return CloneBase<MapLayer>(graph, GetName());
25 }
26 
CreateWorkload(const IWorkloadFactory & factory) const27 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 
ValidateTensorShapesFromInputs()37 void MapLayer::ValidateTensorShapesFromInputs()
38 {
39     // validates that the input is connected.
40     VerifyLayerConnections(1, CHECK_LOCATION());
41     ARMNN_ASSERT(GetNumOutputSlots() == 0);
42 }
43 
ExecuteStrategy(IStrategy & strategy) const44 void MapLayer::ExecuteStrategy(IStrategy& strategy) const
45 {
46     IgnoreUnused(strategy);
47     throw armnn::Exception("MapLayer should not appear in an input graph");
48 }
49 
50 } // namespace armnn
51