33 auto layer = CloneBase<ConstantLayer>(graph,
GetName());
37 return std::move(layer);
42 return std::vector<TensorShape>({ inputShapes[0] });
51 ConditionalThrow<LayerValidationException>(
53 "Constant layer m_LayerOutput output shape can not be Dimensionality::NotSpecified");
55 ConditionalThrow<LayerValidationException>(
57 "Constant layer m_LayerOutput output shape can not have an unspecified dimension");
59 ConditionalThrowIfNotEqual<LayerValidationException>(
60 "ConstantLayer: TensorShape set on OutputSlot[0] does not match the inferred shape.",
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
A layer that the constant data can be bound to.
ConstantLayer(const char *name)
Constructor to create a ConstantLayer.
void SerializeLayerParameters(ParameterStringifyFunction &fn) const override
Helper to serialize the layer parameters to string.
void ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
ConstantLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
By default returns inputShapes if the number of inputs are equal to number of outputs,...
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of ConstantLayer.
std::shared_ptr< ConstTensorHandle > m_LayerOutput
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the Constant type.
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
virtual std::unique_ptr< IWorkload > CreateWorkload(LayerType type, const QueueDescriptor &descriptor, const WorkloadInfo &info) const =0
Backends should implement their own CreateWorkload function with a switch statement.
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *Layer::CreateWorkload.
const char * GetName() const override
Returns the name of the layer.
virtual void SerializeLayerParameters(ParameterStringifyFunction &fn) const
Helper to serialize the layer parameters to string.
void SetAdditionalInfo(QueueDescriptor &descriptor) const
const TensorInfo & GetTensorInfo() const
const void * Map(bool blocking=true)
RAII Managed resource Unmaps MemoryArea once out of scope.
Dimensionality GetDimensionality() const
Function that returns the tensor type.
bool AreAllDimensionsSpecified() const
Checks if there is at least one dimension not specified.
Copyright (c) 2021 ARM Limited and Contributors.
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
constexpr const char * GetDataTypeName(DataType dataType)
std::function< void(const std::string &name, const std::string &value)> ParameterStringifyFunction
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
Base class for all descriptors.
const ConstTensorHandle * m_LayerOutput