37 return std::move(layer);
42 return std::vector<TensorShape>({ inputShapes[0] });
53 "Constant layer m_LayerOutput output shape can not be Dimensionality::NotSpecified");
57 "Constant layer m_LayerOutput output shape can not have an unspecified dimension");
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.
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.
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *LayerCreateWorkload.
Layer(unsigned int numInputSlots, unsigned int numOutputSlots, LayerType type, const char *name)
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
LayerType * CloneBase(Graph &graph, Params &&... params) const
virtual void SerializeLayerParameters(ParameterStringifyFunction &fn) const
Helper to serialize the layer parameters to string.
const char * GetName() const override
Returns the name of the layer.
void SetAdditionalInfo(QueueDescriptor &descriptor) const
const void * Map(bool blocking=true)
RAII Managed resource Unmaps MemoryArea once out of scope.
const TensorInfo & GetTensorInfo() const
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.
constexpr const char * GetDataTypeName(DataType dataType)
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
std::function< void(const std::string &name, const std::string &value)> ParameterStringifyFunction
void ConditionalThrowIfNotEqual(const std::string &message, const ComparedType &leftHandSide, const ComparedType &rightHandSide)
ComparedType must support: operator==(const ComparedType&) operator<<(ostream&, const ComparedType&)
void ConditionalThrow(bool condition, const std::string &message)
armnn::TensorInfo GetTensorInfo(unsigned int numberOfBatches, unsigned int numberOfChannels, unsigned int height, unsigned int width, const armnn::DataLayout dataLayout, const armnn::DataType dataType)
Base class for all descriptors.
const ConstTensorHandle * m_LayerOutput