ArmNN
 20.02
InputLayer.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #include "InputLayer.hpp"
6 
7 #include "LayerCloneBase.hpp"
8 
11 
12 namespace armnn
13 {
14 
16  : BindableLayer(0, 1, LayerType::Input, name, id)
17 {
18 }
19 
20 std::unique_ptr<IWorkload> InputLayer::CreateWorkload(const IWorkloadFactory& factory) const
21 {
22  IgnoreUnused(factory);
23  return nullptr;
24 }
25 
27 {
28  return CloneBase<InputLayer>(graph, GetBindingId(), GetName());
29 }
30 
32 {
33  //The input layer should already have it's inputs set during graph building phase in the driver/parser.
34  ConditionalThrow<LayerValidationException>(GetOutputSlot(0).IsTensorInfoSet(),
35  "InputLayer should already have the TensorInfo set.");
36 }
37 
38 void InputLayer::Accept(ILayerVisitor& visitor) const
39 {
40  visitor.VisitInputLayer(this, this->GetBindingId(), GetName());
41 }
42 
43 } // namespace
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the Input type.
Definition: InputLayer.cpp:20
LayerBindingId GetBindingId() const
Definition: Layer.hpp:406
void Accept(ILayerVisitor &visitor) const override
Apply a visitor to this layer.
Definition: InputLayer.cpp:38
Copyright (c) 2020 ARM Limited.
void IgnoreUnused(Ts &&...)
int LayerBindingId
Type of identifiers for bindable layers (inputs, outputs).
Definition: Types.hpp:171
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of InputLayer.
Definition: InputLayer.cpp:31
InputLayer(LayerBindingId id, const char *name)
Constructor to create an InputLayer.
Definition: InputLayer.cpp:15
A layer user-provided data can be bound to (e.g. inputs, outputs).
Definition: InputLayer.hpp:13
virtual void VisitInputLayer(const IConnectableLayer *layer, LayerBindingId id, const char *name=nullptr)=0
Function that an InputLayer should call back to when its Accept(ILayerVisitor&) function is invoked...
InputLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
Definition: InputLayer.cpp:26
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
Definition: Layer.hpp:312
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:305
bool IsTensorInfoSet() const override
Definition: Layer.cpp:68