45 const unsigned int outputDim = paramsDim - 1 + indicesDim;
47 std::vector<unsigned int> dimSizes;
49 unsigned int axis =
static_cast<unsigned int>(
m_Param.
m_Axis);
52 int32_t axis_aux =
static_cast<int32_t
>(paramsDim) +
m_Param.
m_Axis;
53 axis = static_cast<unsigned int> (axis_aux);
56 for (
unsigned int i = 0; i < axis; ++i)
58 dimSizes.push_back(params.
GetShape()[i]);
60 for (
unsigned int i = axis; i < indicesDim + axis; ++i)
62 dimSizes.push_back(indices.
GetShape()[i - axis]);
64 for (
unsigned int i = 1 + axis; i < paramsDim; ++i)
66 dimSizes.push_back(params.
GetShape()[i]);
GatherDescriptor m_Param
The parameters for the layer (not including tensor-valued weights etc.).
const GatherDescriptor & GetParameters() const
const TensorShape & GetShape() const
void VerifyShapeInferenceType(const TensorShape &outputShape, ShapeInferenceMethod shapeInferenceMethod)
Copyright (c) 2020 ARM Limited.
void ValidateAndCopyShape(const TensorShape &outputShape, const TensorShape &inferredShape, const ShapeInferenceMethod shapeInferenceMethod, const std::string &layerName, const unsigned int outputSlotIndex=0)
GatherLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
void VerifyLayerConnections(unsigned int expectedConnections, const CheckLocation &location) const
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
This layer represents a Gather operator.
void Gather(const TensorInfo ¶msInfo, const TensorInfo &indicesInfo, const TensorInfo &outputInfo, Decoder< float > ¶ms, const int32_t *indices, Encoder< float > &output, const int32_t axis)
A GatherDescriptor for the GatherLayer.
void Accept(ILayerVisitor &visitor) const override
Apply a visitor to this layer.
int32_t m_Axis
The axis in params to gather indices from.
virtual std::unique_ptr< IWorkload > CreateGather(const GatherQueueDescriptor &descriptor, const WorkloadInfo &info) const
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *LayerCreateWorkload.
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
virtual const TensorInfo & GetTensorInfo() const =0
const char * GetName() const override
Returns the name of the layer.
virtual void VisitGatherLayer(const IConnectableLayer *layer, const char *name=nullptr)=0
Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked...
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s).
const TensorInfo & GetTensorInfo() const override
unsigned int GetNumDimensions() const
GatherLayer(const GatherDescriptor ¶m, const char *name)
Constructor to create a GatherLayer.
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the Gather type.
ShapeInferenceMethod m_ShapeInferenceMethod