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 layer that the constant data can be bound to.
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the Constant type.
const TensorShape & GetShape() const
bool AreAllDimensionsSpecified() const
Checks if there is at least one dimension not specified.
void Accept(ILayerVisitor &visitor) const override
Apply a visitor to this layer.
Dimensionality GetDimensionality() const
Function that returns the tensor type.
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of ConstantLayer.
const ConstCpuTensorHandle * m_LayerOutput
virtual std::unique_ptr< IWorkload > CreateConstant(const ConstantQueueDescriptor &descriptor, const WorkloadInfo &info) const
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, otherwise infers the output shapes from given input shapes and layer properties.
Copyright (c) 2020 ARM Limited.
std::unique_ptr< ScopedCpuTensorHandle > m_LayerOutput
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *LayerCreateWorkload.
ConstantLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
virtual void VisitConstantLayer(const IConnectableLayer *layer, const ConstTensor &input, const char *name=nullptr)=0
Function a layer with no inputs and a single output, which always corresponds to the passed in consta...
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
void SetAdditionalInfo(QueueDescriptor &descriptor) const
ConstantLayer(const char *name)
Constructor to create a ConstantLayer.
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
const char * GetName() const override
Returns the name of the layer.
const TensorInfo & GetTensorInfo() const override