31 auto layer = CloneBase<ConstantLayer>(graph,
GetName());
35 return std::move(layer);
40 return std::vector<TensorShape>({ inputShapes[0] });
47 ConditionalThrowIfNotEqual<LayerValidationException>(
48 "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
void Accept(ILayerVisitor &visitor) const override
Apply a visitor to this layer.
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.
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