24.02
|
Go to the documentation of this file.
48 const std::vector<TensorShape>& inputShapes)
const
53 std::vector<unsigned int> outputShape;
54 unsigned int amountDimShrunk{0};
71 "StridedSlice: Attempting to take a larger slice than can fit in inferred output");
77 "StridedSlice: Stride can not be negative with Shrink Axis Mask set.");
82 int newSize = stride > 0 ? ((stop - start) + stride - 1) / stride :
83 ((start - stop) - stride - 1) / -stride;
85 newSize = std::max(0, newSize);
87 outputShape.push_back(armnn::numeric_cast<unsigned int>(newSize));
90 if (outputShape.size() == 0 && (inputShape.
GetNumDimensions() - amountDimShrunk) == 0)
92 outputShape.push_back(1);
95 return std::vector<TensorShape>({
96 TensorShape(armnn::numeric_cast<unsigned int>(outputShape.size()), &outputShape[0]) });
#define ARMNN_ASSERT(COND)
const TensorInfo & GetTensorInfo() const override
std::vector< int > m_Begin
Begin values for the input that will be sliced.
int32_t m_EllipsisMask
Ellipsis mask value.
void ValidateAndCopyShape(const TensorShape &outputShape, const TensorShape &inferredShape, const ShapeInferenceMethod shapeInferenceMethod, const std::string &layerName, const unsigned int outputSlotIndex=0)
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
int32_t m_BeginMask
Begin mask value.
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
const StridedSliceDescriptor & GetParameters() const override
StridedSliceLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
const char * GetName() const override
Returns the name of the layer.
int GetStopForAxis(const TensorShape &inputShape, unsigned int axis, int startForAxis) const
StridedSliceDescriptor m_Param
The parameters for the layer (not including tensor-valued weights etc.).
LayerDescriptor m_Parameters
unsigned int GetNumDimensions() const
Function that returns the tensor rank.
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of StridedSliceLayer.
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *Layer::CreateWorkload.
void VerifyShapeInferenceType(const TensorShape &outputShape, ShapeInferenceMethod shapeInferenceMethod)
void SetAdditionalInfo(QueueDescriptor &descriptor) const
int32_t m_EndMask
End mask value.
int32_t m_ShrinkAxisMask
Shrink axis mask value. If set, the nth specification shrinks the dimensionality by 1.
This layer represents a strided slice operation.
std::vector< int > m_Stride
Stride values for the input that will be sliced.
A StridedSliceDescriptor for the StridedSliceLayer.
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the StridedSlice type.
const TensorShape & GetShape() const
int GetStartForAxis(const TensorShape &inputShape, unsigned int axis) const
Copyright (c) 2021 ARM Limited and Contributors.
void StridedSlice(const TensorInfo &inputInfo, const StridedSliceDescriptor ¶ms, const void *inputData, void *outputData, unsigned int dataTypeSize)
std::vector< int > m_End
End values for the input that will be sliced.
void VerifyLayerConnections(unsigned int expectedConnections, const CheckLocation &location) const
StridedSliceLayer(const StridedSliceDescriptor ¶m, const char *name)
Constructor to create a StridedSliceLayer.
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 ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
ShapeInferenceMethod m_ShapeInferenceMethod
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
int32_t m_NewAxisMask
New axis mask value.
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.
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