18 #include <boost/algorithm/string.hpp> 19 #include <boost/test/unit_test.hpp> 22 const std::vector<armnn::TensorShape>& inputShapes,
23 std::vector<armnn::TensorShape>& outputShapes)
36 const std::vector<armnn::TensorShape> inputShapes
41 std::vector<armnn::TensorShape> outputShapes;
46 BOOST_CHECK(outputShapes[0] == expectedOutputShape);
55 const std::vector<armnn::TensorShape> inputShapes
60 std::vector<armnn::TensorShape> outputShapes;
65 BOOST_CHECK(outputShapes[0] == expectedOutputShape);
74 const std::vector<armnn::TensorShape> inputShapes
79 std::vector<armnn::TensorShape> outputShapes;
84 BOOST_CHECK(outputShapes[0] == expectedOutputShape);
93 const std::vector<armnn::TensorShape> inputShapes
98 std::vector<armnn::TensorShape> outputShapes;
103 BOOST_CHECK(outputShapes[0] == expectedOutputShape);
112 descriptor.
m_Crops = {{0, 0}, {2, 0}};
118 std::vector<armnn::TensorShape> shapes;
119 const std::vector<unsigned int> theDimSizes = {8, 1, 3, 1};
121 shapes.push_back(shape);
123 const std::vector<unsigned int> expectedDimSizes = {2, 2, 4, 1};
140 std::vector<armnn::TensorShape> shapes;
141 const std::vector<unsigned int> dimSizes{ 1, 16, 8, 3 };
143 shapes.push_back(shape);
145 const std::vector<unsigned int> expectedDimSizes{ 1, 8, 4, 12 };
152 std::vector<armnn::TensorShape>& outputShapes)
161 const std::vector<armnn::TensorShape> inputShapes
167 const std::vector<armnn::TensorShape> expectedOutputShapes
172 std::vector<armnn::TensorShape> outputShapes;
176 BOOST_CHECK(outputShapes[0] == expectedOutputShapes[0]);
181 const std::vector<armnn::TensorShape> inputShapes
187 const std::vector<armnn::TensorShape> expectedOutputShapes
192 std::vector<armnn::TensorShape> outputShapes;
196 BOOST_CHECK(outputShapes[0] == expectedOutputShapes[0]);
201 const std::vector<armnn::TensorShape> inputShapes
207 const std::vector<armnn::TensorShape> expectedOutputShapes
212 std::vector<armnn::TensorShape> outputShapes;
216 BOOST_CHECK(outputShapes[0] == expectedOutputShapes[0]);
221 const std::vector<armnn::TensorShape> inputShapes
227 const std::vector<armnn::TensorShape> expectedOutputShapes
232 std::vector<armnn::TensorShape> outputShapes;
236 BOOST_CHECK(outputShapes[0] != expectedOutputShapes[0]);
256 Connect(input, preluLayer, inputTensorInfo, 0, 0);
257 Connect(alpha, preluLayer, alphaTensorInfo, 0, 1);
258 Connect(preluLayer, output, outputTensorInfo, 0, 0);
266 CreatePreluLayerHelper(graph, { 1, 4, 1, 2 }, { 5, 4, 3, 1 }, { 5, 4, 3, 2 });
277 CreatePreluLayerHelper(graph, { 1, 4, 1, 2 }, { 5, 4, 3, 1 }, { 5, 7, 3, 2 });
284 const std::vector<armnn::TensorShape>& inputShapes,
285 std::vector<armnn::TensorShape>& outputShapes)
304 const std::vector<armnn::TensorShape> inputShapes
311 std::vector<armnn::TensorShape> outputShapes;
319 BOOST_CHECK(outputShapes[0] == expectedOutputShape);
334 const std::vector<armnn::TensorShape> inputShapes
342 std::vector<armnn::TensorShape> outputShapes;
350 BOOST_CHECK(outputShapes[0] == expectedOutputShape);
355 const std::vector<armnn::TensorShape>& inputShapes,
362 std::vector<armnn::Layer*> inputs;
363 for (
unsigned int i=0; i<inputShapes.size(); ++i)
370 std::vector<armnn::TensorInfo> inputTensorInfos;
371 for (
unsigned int i=0; i<inputs.size(); ++i)
377 for (
unsigned int i=0; i<inputs.size(); ++i)
379 Connect(inputs[i], stackLayer, inputTensorInfos[i], 0, i);
381 Connect(stackLayer, output, outputTensorInfo, 0, 0);
396 const std::vector<armnn::TensorShape> inputShapes
422 const std::vector<armnn::TensorShape> inputShapes
454 std::vector<armnn::TensorShape> shapes;
455 const std::vector<unsigned int> inputSize = {1, 2, 10, 10};
457 shapes.push_back(inputShape);
459 const std::vector<unsigned int> filterSize = { 1, 2, 2, 2};
461 shapes.push_back(filterShape);
463 const std::vector<unsigned int> expectedOutputSizes = {1, 1, 4, 4};
485 std::vector<armnn::TensorShape> shapes;
486 const std::vector<unsigned int> inputSize = {1, 2, 3, 3};
488 shapes.push_back(inputShape);
490 const std::vector<unsigned int> filterSize = { 1, 2, 3, 3};
492 shapes.push_back(filterShape);
494 const std::vector<unsigned int> expectedOutputSizes = {1, 1, 6, 6};
518 std::vector<armnn::TensorShape> shapes;
519 const std::vector<unsigned int> inputSize = {1, 2, 10, 10};
521 shapes.push_back(inputShape);
523 const std::vector<unsigned int> filterSize = { 1, 2, 3, 3};
525 shapes.push_back(filterShape);
527 const std::vector<unsigned int> expectedOutputSizes = {1, 2, 4, 4};
535 std::vector<armnn::TensorShape>& outputShapes)
545 const std::vector<unsigned int> inputShape{ 2, 5 };
546 const std::vector<unsigned int> previousCellStateInShape{ 2, 10 };
547 const std::vector<unsigned int> previousOutputInShape{ 2, 10 };
549 armnn::TensorShape previousCellStateInTensorShape(2, previousCellStateInShape.data());
552 std::vector<armnn::TensorShape> inShapes
555 previousCellStateInTensorShape,
556 previousOutputInTensorShape
560 const std::vector<unsigned int> cellStateOutShape{ 2, 10 };
561 const std::vector<unsigned int> outputShape{ 2, 10 };
565 std::vector<armnn::TensorShape> expectedOutShapes
567 cellStateOutTensorShape,
571 std::vector<armnn::TensorShape> actualOutShapes;
575 BOOST_CHECK(expectedOutShapes[0] == actualOutShapes[0]);
576 BOOST_CHECK(expectedOutShapes[1] == actualOutShapes[1]);
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
void StackInferOutputShapeFromInputsMatchTest()
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
uint32_t m_PadBottom
Padding bottom value in the height dimension.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
This layer represents a BatchToSpaceNd operation.
This layer represents a 2D transpose convolution operation.
uint32_t m_PadBottom
Padding bottom value in the height dimension.
void PreluInferOutputShapeInputBiggerTest()
uint32_t m_Axis
0-based axis along which to stack the input tensors.
uint32_t m_PadRight
Padding right value in the width dimension.
void QuantizedLstmInferOutputShapeTest()
A BatchToSpaceNdDescriptor for the BatchToSpaceNdLayer.
uint32_t m_DilationX
Dilation factor value for width dimension.
void StackInferOutputShapeImpl(const armnn::StackDescriptor descriptor, const std::vector< armnn::TensorShape > &inputShapes, std::vector< armnn::TensorShape > &outputShapes)
uint32_t m_PadTop
Padding top value in the height dimension.
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
void ArgMinMaxInferOutputShape3dTest()
void StackInferOutputShapeFromInputsNoMatchTest()
uint32_t m_PadLeft
Padding left value in the width dimension.
void PreluValidateTensorShapesFromInputsMatchTest()
This layer represents a depthwise convolution 2d operation.
This layer represents a convolution 2d operation.
This layer represents a stack operation.
void PreluValidateTensorShapesFromInputsNoMatchTest()
TensorShape m_InputShape
Required shape of all input tensors.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
LayerT * AddLayer(Args &&... args)
Adds a new layer, of type LayerType, to the graph constructed with the arguments passed.
This layer represents a SpaceToDepth operation.
This layer represents a ArgMinMax operation.
uint32_t m_PadBottom
Padding bottom value in the height dimension.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
void StackValidateTensorShapesFromInputsNoMatchTest()
void QuantizedLstmInferOutputShapeImpl(const std::vector< armnn::TensorShape > &inputShapes, std::vector< armnn::TensorShape > &outputShapes)
uint32_t m_PadTop
Padding top value in the height dimension.
void ArgMinMaxInferOutputShapeImpl(const armnn::ArgMinMaxDescriptor descriptor, 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 SpaceToDepthDescriptor for the SpaceToDepthLayer.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
void CreateStackLayerHelper(armnn::Graph &graph, const armnn::StackDescriptor &descriptor, const std::vector< armnn::TensorShape > &inputShapes, const armnn::TensorShape &outputShape)
A TransposeConvolution2dDescriptor for the TransposeConvolution2dLayer.
uint32_t m_PadTop
Padding top value in the height dimension.
uint32_t m_PadLeft
Padding left value in the width dimension.
int m_Axis
Axis to reduce across the input tensor.
void BatchToSpaceInferOutputShapeTest()
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
void CreatePreluLayerHelper(armnn::Graph &graph, const armnn::TensorShape &inputShape, const armnn::TensorShape &alphaShape, const armnn::TensorShape &outputShape)
uint32_t m_NumInputs
Number of input tensors.
void ArgMinMaxInferOutputShape4dTest()
void SpaceToDepthInferOutputShapeTest()
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
void DepthwiseConvolution2dInferOutputShapeTest()
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
void ArgMinMaxInferOutputShape2dTest()
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
A layer user-provided data can be bound to (e.g. inputs, outputs).
uint32_t m_PadRight
Padding right value in the width dimension.
void ArgMinMaxInferOutputShape1dTest()
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
A StackDescriptor for the StackLayer.
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
uint32_t m_PadLeft
Padding left value in the width dimension.
void Connect(armnn::IConnectableLayer *from, armnn::IConnectableLayer *to, const armnn::TensorInfo &tensorInfo, unsigned int fromIndex, unsigned int toIndex)
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
void PreluInferOutputShapeAlphaBiggerTest()
void Convolution2dInferOutputShapeTest()
unsigned int m_BlockSize
Scalar specifying the input block size. It must be >= 1.
void TransposeConvolution2dInferOutputShapeTest()
void StackValidateTensorShapesFromInputsMatchTest()
uint32_t m_DilationY
Dilation along y axis.
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
A DepthwiseConvolution2dDescriptor for the DepthwiseConvolution2dLayer.
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
A Convolution2dDescriptor for the Convolution2dLayer.
void PreluInferOutputShapeSameDimsTest()
uint32_t m_DilationX
Dilation along x axis.
void PreluInferOutputShapeImpl(const std::vector< armnn::TensorShape > &inputShapes, std::vector< armnn::TensorShape > &outputShapes)
std::vector< std::pair< unsigned int, unsigned int > > m_Crops
The values to crop from the input dimension.
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
An ArgMinMaxDescriptor for ArgMinMaxLayer.
void PreluInferOutputShapeNoMatchTest()
std::vector< unsigned int > m_BlockShape
Block shape values.
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
uint32_t m_DilationY
Dilation factor value for height dimension.
This layer represents a QuantizedLstm operation.
uint32_t m_PadRight
Padding right value in the width dimension.