17 #include <boost/test/unit_test.hpp> 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;
44 BOOST_CHECK(outputShapes[0] == expectedOutputShape);
53 const std::vector<armnn::TensorShape> inputShapes
58 std::vector<armnn::TensorShape> outputShapes;
63 BOOST_CHECK(outputShapes[0] == expectedOutputShape);
72 const std::vector<armnn::TensorShape> inputShapes
77 std::vector<armnn::TensorShape> outputShapes;
82 BOOST_CHECK(outputShapes[0] == expectedOutputShape);
91 const std::vector<armnn::TensorShape> inputShapes
96 std::vector<armnn::TensorShape> outputShapes;
101 BOOST_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;
174 BOOST_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;
194 BOOST_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;
214 BOOST_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;
234 BOOST_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;
317 BOOST_CHECK(outputShapes[0] == expectedOutputShape);
332 const std::vector<armnn::TensorShape> inputShapes
340 std::vector<armnn::TensorShape> outputShapes;
348 BOOST_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};
483 std::vector<armnn::TensorShape> shapes;
484 const std::vector<unsigned int> inputSize = {1, 2, 3, 3};
486 shapes.push_back(inputShape);
488 const std::vector<unsigned int> filterSize = { 1, 2, 3, 3};
490 shapes.push_back(filterShape);
492 const std::vector<unsigned int> expectedOutputSizes = {1, 1, 6, 6};
516 std::vector<armnn::TensorShape> shapes;
517 const std::vector<unsigned int> inputSize = {1, 2, 10, 10};
519 shapes.push_back(inputShape);
521 const std::vector<unsigned int> filterSize = { 1, 2, 3, 3};
523 shapes.push_back(filterShape);
525 const std::vector<unsigned int> expectedOutputSizes = {1, 2, 4, 4};
533 const std::vector<armnn::TensorShape>& inputShapes,
534 std::vector<armnn::TensorShape>& outputShapes)
549 const std::vector<unsigned int> inputShape{ 2, 5 };
550 const std::vector<unsigned int> previousOutputInShape{ 2, 4 };
551 const std::vector<unsigned int> previousCellStateInShape{ 2, 4 };
555 armnn::TensorShape previousCellStateInTensorShape(2, previousCellStateInShape.data());
557 std::vector<armnn::TensorShape> inShapes
560 previousOutputInTensorShape,
561 previousCellStateInTensorShape
565 const std::vector<unsigned int> outputStateOutShape{ 2, 4 };
566 const std::vector<unsigned int> cellStateOutShape{ 2, 4 };
567 const std::vector<unsigned int> outputShape{ 2, 4 };
572 std::vector<armnn::TensorShape> expectedOutShapes
574 outputStateOutTensorShape,
575 cellStateOutTensorShape,
579 std::vector<armnn::TensorShape> actualOutShapes;
583 BOOST_CHECK(expectedOutShapes[0] == actualOutShapes[0]);
584 BOOST_CHECK(expectedOutShapes[1] == actualOutShapes[1]);
585 BOOST_CHECK(expectedOutShapes[2] == actualOutShapes[2]);
590 std::vector<armnn::TensorShape>& outputShapes)
600 const std::vector<unsigned int> inputShape{ 2, 5 };
601 const std::vector<unsigned int> previousCellStateInShape{ 2, 10 };
602 const std::vector<unsigned int> previousOutputInShape{ 2, 10 };
604 armnn::TensorShape previousCellStateInTensorShape(2, previousCellStateInShape.data());
607 std::vector<armnn::TensorShape> inShapes
610 previousCellStateInTensorShape,
611 previousOutputInTensorShape
615 const std::vector<unsigned int> cellStateOutShape{ 2, 10 };
616 const std::vector<unsigned int> outputShape{ 2, 10 };
620 std::vector<armnn::TensorShape> expectedOutShapes
622 cellStateOutTensorShape,
626 std::vector<armnn::TensorShape> actualOutShapes;
630 BOOST_CHECK(expectedOutShapes[0] == actualOutShapes[0]);
631 BOOST_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.
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.
A Convolution2dDescriptor for the Convolution2dLayer.
uint32_t m_PadLeft
Padding left value in the width dimension.
void ArgMinMaxInferOutputShape1dTest()
This layer represents a SpaceToDepth operation.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
void PreluInferOutputShapeInputBiggerTest()
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_DilationY
Dilation factor value for height dimension.
A BatchToSpaceNdDescriptor for the BatchToSpaceNdLayer.
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
void DepthwiseConvolution2dInferOutputShapeTest()
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)
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.
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.
unsigned int m_BlockSize
Scalar specifying the input block size. It must be >= 1.
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.
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.
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.
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
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_PadLeft
Padding left value in the width dimension.
uint32_t m_PadRight
Padding right value in the width dimension.