xref: /aosp_15_r20/external/armnn/src/armnn/layers/UnmapLayer.cpp (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1 //
2 // Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #include "UnmapLayer.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/UnmapWorkload.hpp>
13 
14 namespace armnn
15 {
16 
UnmapLayer(const char * name)17 UnmapLayer::UnmapLayer(const char* name)
18     : Layer(1, 0, LayerType::Unmap, name)
19 {
20 }
21 
Clone(Graph & graph) const22 UnmapLayer* UnmapLayer::Clone(Graph& graph) const
23 {
24     return CloneBase<UnmapLayer>(graph, GetName());
25 }
26 
CreateWorkload(const IWorkloadFactory & factory) const27 std::unique_ptr<IWorkload> UnmapLayer::CreateWorkload(const IWorkloadFactory& factory) const
28 {
29     IgnoreUnused(factory);
30     UnmapQueueDescriptor 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<UnmapWorkload>(descriptor, PrepInfoAndDesc(descriptor));
35 }
36 
ValidateTensorShapesFromInputs()37 void UnmapLayer::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 UnmapLayer::ExecuteStrategy(IStrategy& strategy) const
45 {
46     IgnoreUnused(strategy);
47     throw armnn::Exception("UnmapLayer should not appear in an input graph");
48 }
49 
50 } // namespace armnn
51