17 #include <doctest/doctest.h> 20 const std::vector<armnn::TensorShape>& inputShapes,
21 std::vector<armnn::TensorShape>& outputShapes)
34 const std::vector<armnn::TensorShape> inputShapes
39 std::vector<armnn::TensorShape> outputShapes;
43 CHECK(outputShapes.size() == 1);
44 CHECK(outputShapes[0] == expectedOutputShape);
53 const std::vector<armnn::TensorShape> inputShapes
58 std::vector<armnn::TensorShape> outputShapes;
62 CHECK(outputShapes.size() == 1);
63 CHECK(outputShapes[0] == expectedOutputShape);
72 const std::vector<armnn::TensorShape> inputShapes
77 std::vector<armnn::TensorShape> outputShapes;
81 CHECK(outputShapes.size() == 1);
82 CHECK(outputShapes[0] == expectedOutputShape);
91 const std::vector<armnn::TensorShape> inputShapes
96 std::vector<armnn::TensorShape> outputShapes;
100 CHECK(outputShapes.size() == 1);
101 CHECK(outputShapes[0] == expectedOutputShape);
110 descriptor.
m_Crops = {{0, 0}, {2, 0}};
116 std::vector<armnn::TensorShape> shapes;
117 const std::vector<unsigned int> theDimSizes = {8, 1, 3, 1};
119 shapes.push_back(shape);
121 const std::vector<unsigned int> expectedDimSizes = {2, 2, 4, 1};
138 std::vector<armnn::TensorShape> shapes;
139 const std::vector<unsigned int> dimSizes{ 1, 16, 8, 3 };
141 shapes.push_back(shape);
143 const std::vector<unsigned int> expectedDimSizes{ 1, 8, 4, 12 };
150 std::vector<armnn::TensorShape>& outputShapes)
159 const std::vector<armnn::TensorShape> inputShapes
165 const std::vector<armnn::TensorShape> expectedOutputShapes
170 std::vector<armnn::TensorShape> outputShapes;
173 CHECK(outputShapes.size() == 1);
174 CHECK(outputShapes[0] == expectedOutputShapes[0]);
179 const std::vector<armnn::TensorShape> inputShapes
185 const std::vector<armnn::TensorShape> expectedOutputShapes
190 std::vector<armnn::TensorShape> outputShapes;
193 CHECK(outputShapes.size() == 1);
194 CHECK(outputShapes[0] == expectedOutputShapes[0]);
199 const std::vector<armnn::TensorShape> inputShapes
205 const std::vector<armnn::TensorShape> expectedOutputShapes
210 std::vector<armnn::TensorShape> outputShapes;
213 CHECK(outputShapes.size() == 1);
214 CHECK(outputShapes[0] == expectedOutputShapes[0]);
219 const std::vector<armnn::TensorShape> inputShapes
225 const std::vector<armnn::TensorShape> expectedOutputShapes
230 std::vector<armnn::TensorShape> outputShapes;
233 CHECK(outputShapes.size() == 1);
234 CHECK(outputShapes[0] != expectedOutputShapes[0]);
254 Connect(input, preluLayer, inputTensorInfo, 0, 0);
255 Connect(alpha, preluLayer, alphaTensorInfo, 0, 1);
256 Connect(preluLayer, output, outputTensorInfo, 0, 0);
264 CreatePreluLayerHelper(graph, { 1, 4, 1, 2 }, { 5, 4, 3, 1 }, { 5, 4, 3, 2 });
275 CreatePreluLayerHelper(graph, { 1, 4, 1, 2 }, { 5, 4, 3, 1 }, { 5, 7, 3, 2 });
282 const std::vector<armnn::TensorShape>& inputShapes,
283 std::vector<armnn::TensorShape>& outputShapes)
302 const std::vector<armnn::TensorShape> inputShapes
309 std::vector<armnn::TensorShape> outputShapes;
316 CHECK(outputShapes.size() == 1);
317 CHECK(outputShapes[0] == expectedOutputShape);
332 const std::vector<armnn::TensorShape> inputShapes
340 std::vector<armnn::TensorShape> outputShapes;
347 CHECK(outputShapes.size() == 1);
348 CHECK(outputShapes[0] == expectedOutputShape);
353 const std::vector<armnn::TensorShape>& inputShapes,
360 std::vector<armnn::Layer*> inputs;
361 for (
unsigned int i=0; i<inputShapes.size(); ++i)
368 std::vector<armnn::TensorInfo> inputTensorInfos;
369 for (
unsigned int i=0; i<inputs.size(); ++i)
375 for (
unsigned int i=0; i<inputs.size(); ++i)
377 Connect(inputs[i], stackLayer, inputTensorInfos[i], 0, i);
379 Connect(stackLayer, output, outputTensorInfo, 0, 0);
394 const std::vector<armnn::TensorShape> inputShapes
420 const std::vector<armnn::TensorShape> inputShapes
452 std::vector<armnn::TensorShape> shapes;
453 const std::vector<unsigned int> inputSize = {1, 2, 10, 10};
455 shapes.push_back(inputShape);
457 const std::vector<unsigned int> filterSize = { 1, 2, 2, 2};
459 shapes.push_back(filterShape);
461 const std::vector<unsigned int> expectedOutputSizes = {1, 1, 4, 4};
464 CHECK(expectedOutputShape == convolution2dLayer->
InferOutputShapes(shapes).at(0));
489 std::vector<armnn::TensorShape> shapes;
490 const std::vector<unsigned int> inputSize = {1, 5, 5, 5, 1};
492 shapes.push_back(inputShape);
494 const std::vector<unsigned int> filterSize = {3, 3, 3, 1, 1 };
496 shapes.push_back(filterShape);
498 const std::vector<unsigned int> expectedOutputSizes = {1, 3, 3, 3, 1};
501 CHECK(expectedOutputShape == convolution3dLayer->
InferOutputShapes(shapes).at(0));
520 std::vector<armnn::TensorShape> shapes;
521 const std::vector<unsigned int> inputSize = {1, 2, 3, 3};
523 shapes.push_back(inputShape);
525 const std::vector<unsigned int> filterSize = { 1, 2, 3, 3};
527 shapes.push_back(filterShape);
529 const std::vector<unsigned int> expectedOutputSizes = {1, 1, 6, 6};
532 CHECK(expectedOutputShape == transposeConvolution2dLayer->
InferOutputShapes(shapes).at(0));
553 std::vector<armnn::TensorShape> shapes;
554 const std::vector<unsigned int> inputSize = {1, 2, 10, 10};
556 shapes.push_back(inputShape);
558 const std::vector<unsigned int> filterSize = { 1, 3, 3, 2 };
560 shapes.push_back(filterShape);
562 const std::vector<unsigned int> expectedOutputSizes = {1, 2, 4, 4};
565 CHECK(expectedOutputShape == depthwiseConvolution2dLayer->
InferOutputShapes(shapes).at(0));
570 const std::vector<armnn::TensorShape>& inputShapes,
571 std::vector<armnn::TensorShape>& outputShapes)
586 const std::vector<unsigned int> inputShape{ 2, 5 };
587 const std::vector<unsigned int> previousOutputInShape{ 2, 4 };
588 const std::vector<unsigned int> previousCellStateInShape{ 2, 4 };
592 armnn::TensorShape previousCellStateInTensorShape(2, previousCellStateInShape.data());
594 std::vector<armnn::TensorShape> inShapes
597 previousOutputInTensorShape,
598 previousCellStateInTensorShape
602 const std::vector<unsigned int> outputStateOutShape{ 2, 4 };
603 const std::vector<unsigned int> cellStateOutShape{ 2, 4 };
604 const std::vector<unsigned int> outputShape{ 2, 4 };
609 std::vector<armnn::TensorShape> expectedOutShapes
611 outputStateOutTensorShape,
612 cellStateOutTensorShape,
616 std::vector<armnn::TensorShape> actualOutShapes;
619 CHECK(actualOutShapes.size() == 3);
620 CHECK(expectedOutShapes[0] == actualOutShapes[0]);
621 CHECK(expectedOutShapes[1] == actualOutShapes[1]);
622 CHECK(expectedOutShapes[2] == actualOutShapes[2]);
627 std::vector<armnn::TensorShape>& outputShapes)
637 const std::vector<unsigned int> inputShape{ 2, 5 };
638 const std::vector<unsigned int> previousCellStateInShape{ 2, 10 };
639 const std::vector<unsigned int> previousOutputInShape{ 2, 10 };
641 armnn::TensorShape previousCellStateInTensorShape(2, previousCellStateInShape.data());
644 std::vector<armnn::TensorShape> inShapes
647 previousCellStateInTensorShape,
648 previousOutputInTensorShape
652 const std::vector<unsigned int> cellStateOutShape{ 2, 10 };
653 const std::vector<unsigned int> outputShape{ 2, 10 };
657 std::vector<armnn::TensorShape> expectedOutShapes
659 cellStateOutTensorShape,
663 std::vector<armnn::TensorShape> actualOutShapes;
666 CHECK(actualOutShapes.size() == 2);
667 CHECK(expectedOutShapes[0] == actualOutShapes[0]);
668 CHECK(expectedOutShapes[1] == actualOutShapes[1]);
uint32_t m_PadBottom
Padding bottom value in the height dimension.
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.
void StackInferOutputShapeImpl(const armnn::StackDescriptor descriptor, const std::vector< armnn::TensorShape > &inputShapes, std::vector< armnn::TensorShape > &outputShapes)
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
uint32_t m_Axis
0-based axis along which to stack the input tensors.
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.
This layer represents a 2D transpose convolution operation.
void QuantizedLstmInferOutputShapeTest()
A TransposeConvolution2dDescriptor for the TransposeConvolution2dLayer.
uint32_t m_PadBottom
Padding bottom value in the height dimension.
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.
uint32_t m_PadBack
Padding back value in the depth dimension.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
This layer represents a depthwise convolution 2d operation.
TensorShape m_InputShape
Required shape of all input tensors.
LayerT * AddLayer(Args &&... args)
Adds a new layer, of type LayerType, to the graph constructed with the arguments passed.
void PreluValidateTensorShapesFromInputsMatchTest()
bool m_PeepholeEnabled
Enable/disable peephole.
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
A Convolution2dDescriptor for the Convolution2dLayer.
uint32_t m_PadLeft
Padding left value in the width dimension.
void ArgMinMaxInferOutputShape1dTest()
This layer represents a SpaceToDepth operation.
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.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
void PreluInferOutputShapeInputBiggerTest()
uint32_t m_PadBottom
Padding bottom value in the height dimension.
uint32_t m_PadRight
Padding right value in the width dimension.
void TransposeConvolution2dInferOutputShapeTest()
void ArgMinMaxInferOutputShape4dTest()
uint32_t m_PadBottom
Padding bottom value in the height dimension.
uint32_t m_DilationY
Dilation along y axis.
A SpaceToDepthDescriptor for the SpaceToDepthLayer.
uint32_t m_DilationX
Dilation along x axis.
uint32_t m_DilationY
Dilation factor value for height dimension.
A BatchToSpaceNdDescriptor for the BatchToSpaceNdLayer.
void DepthwiseConvolution2dInferOutputShapeTest()
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
A StackDescriptor for the StackLayer.
uint32_t m_PadTop
Padding top value in the height dimension.
void PreluInferOutputShapeAlphaBiggerTest()
void StackValidateTensorShapesFromInputsMatchTest()
void StackInferOutputShapeFromInputsNoMatchTest()
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
A layer user-provided data can be bound to (e.g. inputs, outputs).
void CreateStackLayerHelper(armnn::Graph &graph, const armnn::StackDescriptor &descriptor, const std::vector< armnn::TensorShape > &inputShapes, const armnn::TensorShape &outputShape)
void SpaceToDepthInferOutputShapeTest()
void BatchToSpaceInferOutputShapeTest()
uint32_t m_DilationX
Dilation factor value for width dimension.
uint32_t m_PadTop
Padding top value in the height dimension.
This layer represents a QuantizedLstm operation.
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.
std::vector< unsigned int > m_BlockShape
Block shape values.
An ArgMinMaxDescriptor for ArgMinMaxLayer.
void CreatePreluLayerHelper(armnn::Graph &graph, const armnn::TensorShape &inputShape, const armnn::TensorShape &alphaShape, const armnn::TensorShape &outputShape)
This layer represents a stack operation.
void Convolution2dInferOutputShapeTest()
This layer represents a BatchToSpaceNd operation.
void ArgMinMaxInferOutputShape3dTest()
uint32_t m_PadTop
Padding top value in the height dimension.
This layer represents a ArgMinMax operation.
A QLstmDescriptor for the QLstmLayer.
void QLstmInferOutputShapeImpl(const armnn::QLstmDescriptor descriptor, const std::vector< armnn::TensorShape > &inputShapes, std::vector< armnn::TensorShape > &outputShapes)
uint32_t m_PadFront
Padding front value in the depth dimension.
void ArgMinMaxInferOutputShapeImpl(const armnn::ArgMinMaxDescriptor descriptor, const std::vector< armnn::TensorShape > &inputShapes, std::vector< armnn::TensorShape > &outputShapes)
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
uint32_t m_NumInputs
Number of input tensors.
uint32_t m_PadLeft
Padding left value in the width dimension.
void QuantizedLstmInferOutputShapeImpl(const std::vector< armnn::TensorShape > &inputShapes, std::vector< armnn::TensorShape > &outputShapes)
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
A Convolution3dDescriptor for the Convolution3dLayer.
uint32_t m_PadRight
Padding right value in the width dimension.
unsigned int m_BlockSize
Scalar specifying the input block size. It must be >= 1.
DataLayout m_DataLayout
The data layout to be used (NDHWC, NCDHW).
This layer represents a QLstm operation.
uint32_t m_DilationX
Dilation along x axis.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
void PreluInferOutputShapeSameDimsTest()
uint32_t m_PadLeft
Padding left value in the width dimension.
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
void StackValidateTensorShapesFromInputsNoMatchTest()
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
void PreluInferOutputShapeImpl(const std::vector< armnn::TensorShape > &inputShapes, std::vector< armnn::TensorShape > &outputShapes)
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
void PreluValidateTensorShapesFromInputsNoMatchTest()
void StackInferOutputShapeFromInputsMatchTest()
std::vector< std::pair< unsigned int, unsigned int > > m_Crops
The values to crop from the input dimension.
uint32_t m_PadTop
Padding top value in the height dimension.
bool m_ProjectionEnabled
Enable/disable the projection layer.
uint32_t m_PadRight
Padding right value in the width dimension.
int m_Axis
Axis to reduce across the input tensor.
void ArgMinMaxInferOutputShape2dTest()
This layer represents a convolution 2d operation.
This layer represents a convolution 3d operation.
void Connect(armnn::IConnectableLayer *from, armnn::IConnectableLayer *to, const armnn::TensorInfo &tensorInfo, unsigned int fromIndex, unsigned int toIndex)
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.
void QLstmInferOutputShapeTest()
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
Infers the output shape from a given input shape and axis parameter.
void PreluInferOutputShapeNoMatchTest()
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.
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
Infers the output shapes from given input shapes and layer properties.
uint32_t m_DilationZ
Dilation along z axis.
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.
uint32_t m_StrideZ
Stride value when proceeding through input for the depth dimension.
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.
bool m_CifgEnabled
Enable/disable CIFG (coupled input & forget gate).
A DepthwiseConvolution2dDescriptor for the DepthwiseConvolution2dLayer.
uint32_t m_DilationY
Dilation along y axis.
uint32_t m_PadLeft
Padding left value in the width dimension.
void Convolution3dInferOutputShapeTest()
uint32_t m_PadRight
Padding right value in the width dimension.