48 const std::vector<TensorShape>& inputShapes)
const 53 std::vector<unsigned int> outputShape;
54 unsigned int amountDimShrunk{0};
56 for (
unsigned int i = 0; i < inputShape.GetNumDimensions(); i++)
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]) });
StridedSliceDescriptor m_Param
The parameters for the layer (not including tensor-valued weights etc.).
const StridedSliceDescriptor & GetParameters() const
const TensorShape & GetShape() const
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the StridedSlice type.
int32_t m_ShrinkAxisMask
Shrink axis mask value. If set, the nth specification shrinks the dimensionality by 1...
std::vector< int > m_Begin
Begin values for the input that will be sliced.
#define ARMNN_NO_DEPRECATE_WARN_BEGIN
int GetStartForAxis(const TensorShape &inputShape, unsigned int axis) const
virtual std::unique_ptr< IWorkload > CreateStridedSlice(const StridedSliceQueueDescriptor &descriptor, const WorkloadInfo &Info) const
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of StridedSliceLayer.
void VerifyShapeInferenceType(const TensorShape &outputShape, ShapeInferenceMethod shapeInferenceMethod)
Copyright (c) 2021 ARM Limited and Contributors.
int32_t m_BeginMask
Begin mask value.
int32_t m_EndMask
End mask value.
LayerDescriptor m_Parameters
void ValidateAndCopyShape(const TensorShape &outputShape, const TensorShape &inferredShape, const ShapeInferenceMethod shapeInferenceMethod, const std::string &layerName, const unsigned int outputSlotIndex=0)
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.
ARMNN_NO_DEPRECATE_WARN_BEGIN void Accept(ILayerVisitor &visitor) const override
#define ARMNN_NO_DEPRECATE_WARN_END
int32_t m_NewAxisMask
New axis mask value.
int32_t m_EllipsisMask
Ellipsis mask value.
#define ARMNN_ASSERT(COND)
std::vector< int > m_Stride
Stride values for the input that will be sliced.
void SetAdditionalInfo(QueueDescriptor &descriptor) const
std::vector< int > m_End
End values for the input that will be sliced.
void StridedSlice(const TensorInfo &inputInfo, const StridedSliceDescriptor ¶ms, const void *inputData, void *outputData, unsigned int dataTypeSize)
StridedSliceLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *LayerCreateWorkload.
This layer represents a strided slice operation.
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
A StridedSliceDescriptor for the StridedSliceLayer.
virtual const TensorInfo & GetTensorInfo() const =0
int GetStopForAxis(const TensorShape &inputShape, unsigned int axis, int startForAxis) const
const char * GetName() const override
Returns the name of the layer.
const TensorInfo & GetTensorInfo() const override
StridedSliceLayer(const StridedSliceDescriptor ¶m, const char *name)
Constructor to create a StridedSliceLayer.
ShapeInferenceMethod m_ShapeInferenceMethod
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below...
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.