ArmNN
 24.02
StandInLayer.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "StandInLayer.hpp"
7 #include "LayerCloneBase.hpp"
8 
9 namespace armnn
10 {
11 
12 StandInLayer::StandInLayer(const StandInDescriptor& param, const char* name)
13  : LayerWithParameters(param.m_NumInputs, param.m_NumOutputs, LayerType::StandIn, param, name)
14 {
15 }
16 
17 std::unique_ptr<IWorkload> StandInLayer::CreateWorkload(const IWorkloadFactory& factory) const
18 {
19  IgnoreUnused(factory);
20  // This throws in the event that it's called. We would expect that any backend that
21  // "claims" to support the StandInLayer type would actually substitute it with a PrecompiledLayer
22  // during graph optimization. There is no interface on the IWorkloadFactory to create a StandInWorkload.
23  throw Exception("Stand in layer does not support creating workloads");
24 }
25 
27 {
28  return CloneBase<StandInLayer>(graph, m_Param, GetName());
29 }
30 
31 std::vector<TensorShape> StandInLayer::InferOutputShapes(const std::vector<TensorShape>& inputShapes) const
32 {
33  IgnoreUnused(inputShapes);
34  throw Exception("Stand in layer does not support infering output shapes");
35 }
36 
38 {
39 
40  // Cannot validate this layer since no implementation details can be known by the framework
41  // so do nothing here.
42 }
43 
45 {
46  strategy.ExecuteStrategy(this, GetParameters(), {}, GetName());
47 }
48 
49 } // namespace armnn
armnn::IStrategy
Definition: IStrategy.hpp:16
armnn::LayerWithParameters< StandInDescriptor >::GetParameters
const StandInDescriptor & GetParameters() const override
Definition: LayerWithParameters.hpp:19
armnn::LayerWithParameters
Definition: LayerWithParameters.hpp:14
armnn::Layer::GetName
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:332
armnn::StandInLayer::StandInLayer
StandInLayer(const StandInDescriptor &param, const char *name)
Constructor to create a StandInLayer.
Definition: StandInLayer.cpp:12
armnn::LayerWithParameters< StandInDescriptor >::m_Param
StandInDescriptor m_Param
The parameters for the layer (not including tensor-valued weights etc.).
Definition: LayerWithParameters.hpp:52
armnn::StandInLayer::ValidateTensorShapesFromInputs
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) Does nothing since cannot validate any properties of this layer.
Definition: StandInLayer.cpp:37
armnn::LayerType::StandIn
@ StandIn
armnn::IWorkloadFactory
Definition: WorkloadFactory.hpp:22
armnn::StandInLayer::InferOutputShapes
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
Empty implementation that throws Exception if called.
Definition: StandInLayer.cpp:31
armnn::StandInLayer
This layer represents an unknown operation in the input graph.
Definition: StandInLayer.hpp:14
armnn::Exception
Base class for all ArmNN exceptions so that users can filter to just those.
Definition: Exceptions.hpp:46
armnn::StandInLayer::ExecuteStrategy
void ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
Definition: StandInLayer.cpp:44
armnn::StandInLayer::CreateWorkload
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Empty implementation explictly does NOT create a workload.
Definition: StandInLayer.cpp:17
armnn::StandInDescriptor
A StandInDescriptor for the StandIn layer.
Definition: Descriptors.hpp:1281
armnn::IgnoreUnused
void IgnoreUnused(Ts &&...)
Definition: IgnoreUnused.hpp:14
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::StandInLayer::Clone
StandInLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
Definition: StandInLayer.cpp:26
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
armnn::IStrategy::ExecuteStrategy
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
LayerCloneBase.hpp
StandInLayer.hpp