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_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()
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.
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.
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_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.
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
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.
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.