diff options
author | Sadik Armagan <sadik.armagan@arm.com> | 2021-06-10 18:24:34 +0100 |
---|---|---|
committer | Sadik Armagan <sadik.armagan@arm.com> | 2021-06-11 10:33:16 +0000 |
commit | 1625efc870f1a8b7c6e6382277ddbb245f91a294 (patch) | |
tree | 39fbbaa15ed7eb81337b082c2d20b0af68b91c02 /src/armnn/test/InferOutputTests.hpp | |
parent | 958e0ba61e940a8d11955cf2a10f681c7c47e1fa (diff) | |
download | armnn-1625efc870f1a8b7c6e6382277ddbb245f91a294.tar.gz |
IVGCVSW-5963 'Move unit tests to new framework'
* Used doctest in ArmNN unit tests
Signed-off-by: Sadik Armagan <sadik.armagan@arm.com>
Change-Id: Ia9cf5fc72775878885c5f864abf2c56b3a935f1a
Diffstat (limited to 'src/armnn/test/InferOutputTests.hpp')
-rw-r--r-- | src/armnn/test/InferOutputTests.hpp | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/src/armnn/test/InferOutputTests.hpp b/src/armnn/test/InferOutputTests.hpp index 0413682dad..b8276de80c 100644 --- a/src/armnn/test/InferOutputTests.hpp +++ b/src/armnn/test/InferOutputTests.hpp @@ -14,7 +14,7 @@ #include <layers/PreluLayer.hpp> #include <layers/StackLayer.hpp> -#include <boost/test/unit_test.hpp> +#include <doctest/doctest.h> void ArgMinMaxInferOutputShapeImpl(const armnn::ArgMinMaxDescriptor descriptor, const std::vector<armnn::TensorShape>& inputShapes, @@ -37,11 +37,11 @@ void ArgMinMaxInferOutputShape4dTest() }; std::vector<armnn::TensorShape> outputShapes; - BOOST_CHECK_NO_THROW(ArgMinMaxInferOutputShapeImpl(descriptor, inputShapes, outputShapes)); + CHECK_NOTHROW(ArgMinMaxInferOutputShapeImpl(descriptor, inputShapes, outputShapes)); armnn::TensorShape expectedOutputShape( { 1, 3, 4 } ); - BOOST_CHECK(outputShapes.size() == 1); - BOOST_CHECK(outputShapes[0] == expectedOutputShape); + CHECK(outputShapes.size() == 1); + CHECK(outputShapes[0] == expectedOutputShape); } void ArgMinMaxInferOutputShape3dTest() @@ -56,11 +56,11 @@ void ArgMinMaxInferOutputShape3dTest() }; std::vector<armnn::TensorShape> outputShapes; - BOOST_CHECK_NO_THROW(ArgMinMaxInferOutputShapeImpl(descriptor, inputShapes, outputShapes)); + CHECK_NOTHROW(ArgMinMaxInferOutputShapeImpl(descriptor, inputShapes, outputShapes)); armnn::TensorShape expectedOutputShape( { 3, 2 } ); - BOOST_CHECK(outputShapes.size() == 1); - BOOST_CHECK(outputShapes[0] == expectedOutputShape); + CHECK(outputShapes.size() == 1); + CHECK(outputShapes[0] == expectedOutputShape); } void ArgMinMaxInferOutputShape2dTest() @@ -75,11 +75,11 @@ void ArgMinMaxInferOutputShape2dTest() }; std::vector<armnn::TensorShape> outputShapes; - BOOST_CHECK_NO_THROW(ArgMinMaxInferOutputShapeImpl(descriptor, inputShapes, outputShapes)); + CHECK_NOTHROW(ArgMinMaxInferOutputShapeImpl(descriptor, inputShapes, outputShapes)); armnn::TensorShape expectedOutputShape( { 3 } ); - BOOST_CHECK(outputShapes.size() == 1); - BOOST_CHECK(outputShapes[0] == expectedOutputShape); + CHECK(outputShapes.size() == 1); + CHECK(outputShapes[0] == expectedOutputShape); } void ArgMinMaxInferOutputShape1dTest() @@ -94,11 +94,11 @@ void ArgMinMaxInferOutputShape1dTest() }; std::vector<armnn::TensorShape> outputShapes; - BOOST_CHECK_NO_THROW(ArgMinMaxInferOutputShapeImpl(descriptor, inputShapes, outputShapes)); + CHECK_NOTHROW(ArgMinMaxInferOutputShapeImpl(descriptor, inputShapes, outputShapes)); armnn::TensorShape expectedOutputShape( { 1 } ); - BOOST_CHECK(outputShapes.size() == 1); - BOOST_CHECK(outputShapes[0] == expectedOutputShape); + CHECK(outputShapes.size() == 1); + CHECK(outputShapes[0] == expectedOutputShape); } void BatchToSpaceInferOutputShapeTest() @@ -121,7 +121,7 @@ void BatchToSpaceInferOutputShapeTest() const std::vector<unsigned int> expectedDimSizes = {2, 2, 4, 1}; armnn::TensorShape expectedShape(4, expectedDimSizes.data()); - BOOST_CHECK(expectedShape == batchToSpaceLayer->InferOutputShapes(shapes).at(0)); + CHECK(expectedShape == batchToSpaceLayer->InferOutputShapes(shapes).at(0)); } void SpaceToDepthInferOutputShapeTest() @@ -143,7 +143,7 @@ void SpaceToDepthInferOutputShapeTest() const std::vector<unsigned int> expectedDimSizes{ 1, 8, 4, 12 }; armnn::TensorShape expectedShape(4, expectedDimSizes.data()); - BOOST_CHECK(expectedShape == spaceToDepthLayer->InferOutputShapes(shapes).at(0)); + CHECK(expectedShape == spaceToDepthLayer->InferOutputShapes(shapes).at(0)); } void PreluInferOutputShapeImpl(const std::vector<armnn::TensorShape>& inputShapes, @@ -168,10 +168,10 @@ void PreluInferOutputShapeSameDimsTest() }; std::vector<armnn::TensorShape> outputShapes; - BOOST_CHECK_NO_THROW(PreluInferOutputShapeImpl(inputShapes, outputShapes)); + CHECK_NOTHROW(PreluInferOutputShapeImpl(inputShapes, outputShapes)); - BOOST_CHECK(outputShapes.size() == 1); - BOOST_CHECK(outputShapes[0] == expectedOutputShapes[0]); + CHECK(outputShapes.size() == 1); + CHECK(outputShapes[0] == expectedOutputShapes[0]); } void PreluInferOutputShapeInputBiggerTest() @@ -188,10 +188,10 @@ void PreluInferOutputShapeInputBiggerTest() }; std::vector<armnn::TensorShape> outputShapes; - BOOST_CHECK_NO_THROW(PreluInferOutputShapeImpl(inputShapes, outputShapes)); + CHECK_NOTHROW(PreluInferOutputShapeImpl(inputShapes, outputShapes)); - BOOST_CHECK(outputShapes.size() == 1); - BOOST_CHECK(outputShapes[0] == expectedOutputShapes[0]); + CHECK(outputShapes.size() == 1); + CHECK(outputShapes[0] == expectedOutputShapes[0]); } void PreluInferOutputShapeAlphaBiggerTest() @@ -208,10 +208,10 @@ void PreluInferOutputShapeAlphaBiggerTest() }; std::vector<armnn::TensorShape> outputShapes; - BOOST_CHECK_NO_THROW(PreluInferOutputShapeImpl(inputShapes, outputShapes)); + CHECK_NOTHROW(PreluInferOutputShapeImpl(inputShapes, outputShapes)); - BOOST_CHECK(outputShapes.size() == 1); - BOOST_CHECK(outputShapes[0] == expectedOutputShapes[0]); + CHECK(outputShapes.size() == 1); + CHECK(outputShapes[0] == expectedOutputShapes[0]); } void PreluInferOutputShapeNoMatchTest() @@ -228,10 +228,10 @@ void PreluInferOutputShapeNoMatchTest() }; std::vector<armnn::TensorShape> outputShapes; - BOOST_CHECK_NO_THROW(PreluInferOutputShapeImpl(inputShapes, outputShapes)); + CHECK_NOTHROW(PreluInferOutputShapeImpl(inputShapes, outputShapes)); - BOOST_CHECK(outputShapes.size() == 1); - BOOST_CHECK(outputShapes[0] != expectedOutputShapes[0]); + CHECK(outputShapes.size() == 1); + CHECK(outputShapes[0] != expectedOutputShapes[0]); } void CreatePreluLayerHelper(armnn::Graph& graph, @@ -264,7 +264,7 @@ void PreluValidateTensorShapesFromInputsMatchTest() CreatePreluLayerHelper(graph, { 1, 4, 1, 2 }, { 5, 4, 3, 1 }, { 5, 4, 3, 2 }); // Graph::InferTensorInfos calls Layer::ValidateTensorShapesFromInputs - BOOST_CHECK_NO_THROW(graph.InferTensorInfos()); + CHECK_NOTHROW(graph.InferTensorInfos()); } void PreluValidateTensorShapesFromInputsNoMatchTest() @@ -275,7 +275,7 @@ void PreluValidateTensorShapesFromInputsNoMatchTest() CreatePreluLayerHelper(graph, { 1, 4, 1, 2 }, { 5, 4, 3, 1 }, { 5, 7, 3, 2 }); // Graph::InferTensorInfos calls Layer::ValidateTensorShapesFromInputs - BOOST_CHECK_THROW(graph.InferTensorInfos(), armnn::LayerValidationException); + CHECK_THROWS_AS(graph.InferTensorInfos(), armnn::LayerValidationException); } void StackInferOutputShapeImpl(const armnn::StackDescriptor descriptor, @@ -307,14 +307,14 @@ void StackInferOutputShapeFromInputsMatchTest() }; std::vector<armnn::TensorShape> outputShapes; - BOOST_CHECK_NO_THROW(StackInferOutputShapeImpl(descriptor, inputShapes, outputShapes)); + CHECK_NOTHROW(StackInferOutputShapeImpl(descriptor, inputShapes, outputShapes)); armnn::TensorShape expectedOutputShape ( { 4, 3, 2 } ); - BOOST_CHECK(outputShapes.size() == 1); - BOOST_CHECK(outputShapes[0] == expectedOutputShape); + CHECK(outputShapes.size() == 1); + CHECK(outputShapes[0] == expectedOutputShape); } void StackInferOutputShapeFromInputsNoMatchTest() @@ -338,14 +338,14 @@ void StackInferOutputShapeFromInputsNoMatchTest() // Output shape is inferred from the descriptor, so should still be correct despite mismatching input shapes std::vector<armnn::TensorShape> outputShapes; - BOOST_CHECK_NO_THROW(StackInferOutputShapeImpl(descriptor, inputShapes, outputShapes)); + CHECK_NOTHROW(StackInferOutputShapeImpl(descriptor, inputShapes, outputShapes)); armnn::TensorShape expectedOutputShape ( { 4, 3, 2 } ); - BOOST_CHECK(outputShapes.size() == 1); - BOOST_CHECK(outputShapes[0] == expectedOutputShape); + CHECK(outputShapes.size() == 1); + CHECK(outputShapes[0] == expectedOutputShape); } void CreateStackLayerHelper(armnn::Graph& graph, @@ -402,7 +402,7 @@ void StackValidateTensorShapesFromInputsMatchTest() CreateStackLayerHelper(graph, descriptor, inputShapes, { 3, 2, 5 }); // Graph::InferTensorInfos calls Layer::ValidateTensorShapesFromInputs - BOOST_CHECK_NO_THROW(graph.InferTensorInfos()); + CHECK_NOTHROW(graph.InferTensorInfos()); } void StackValidateTensorShapesFromInputsNoMatchTest() @@ -428,7 +428,7 @@ void StackValidateTensorShapesFromInputsNoMatchTest() CreateStackLayerHelper(graph, descriptor, inputShapes, { 3, 2, 5 }); // Graph::InferTensorInfos calls Layer::ValidateTensorShapesFromInputs - BOOST_CHECK_THROW(graph.InferTensorInfos(), armnn::LayerValidationException); + CHECK_THROWS_AS(graph.InferTensorInfos(), armnn::LayerValidationException); } void Convolution2dInferOutputShapeTest() @@ -461,7 +461,7 @@ void Convolution2dInferOutputShapeTest() const std::vector<unsigned int> expectedOutputSizes = {1, 1, 4, 4}; armnn::TensorShape expectedOutputShape(4, expectedOutputSizes.data()); - BOOST_CHECK(expectedOutputShape == convolution2dLayer->InferOutputShapes(shapes).at(0)); + CHECK(expectedOutputShape == convolution2dLayer->InferOutputShapes(shapes).at(0)); } void TransposeConvolution2dInferOutputShapeTest() @@ -492,7 +492,7 @@ void TransposeConvolution2dInferOutputShapeTest() const std::vector<unsigned int> expectedOutputSizes = {1, 1, 6, 6}; armnn::TensorShape expectedOutputShape(4, expectedOutputSizes.data()); - BOOST_CHECK(expectedOutputShape == transposeConvolution2dLayer->InferOutputShapes(shapes).at(0)); + CHECK(expectedOutputShape == transposeConvolution2dLayer->InferOutputShapes(shapes).at(0)); } void DepthwiseConvolution2dInferOutputShapeTest() @@ -525,7 +525,7 @@ void DepthwiseConvolution2dInferOutputShapeTest() const std::vector<unsigned int> expectedOutputSizes = {1, 2, 4, 4}; armnn::TensorShape expectedOutputShape(4, expectedOutputSizes.data()); - BOOST_CHECK(expectedOutputShape == depthwiseConvolution2dLayer->InferOutputShapes(shapes).at(0)); + CHECK(expectedOutputShape == depthwiseConvolution2dLayer->InferOutputShapes(shapes).at(0)); } // QLstm @@ -577,12 +577,12 @@ void QLstmInferOutputShapeTest() }; std::vector<armnn::TensorShape> actualOutShapes; - BOOST_CHECK_NO_THROW(QLstmInferOutputShapeImpl(descriptor, inShapes, actualOutShapes)); + CHECK_NOTHROW(QLstmInferOutputShapeImpl(descriptor, inShapes, actualOutShapes)); - BOOST_CHECK(actualOutShapes.size() == 3); - BOOST_CHECK(expectedOutShapes[0] == actualOutShapes[0]); - BOOST_CHECK(expectedOutShapes[1] == actualOutShapes[1]); - BOOST_CHECK(expectedOutShapes[2] == actualOutShapes[2]); + CHECK(actualOutShapes.size() == 3); + CHECK(expectedOutShapes[0] == actualOutShapes[0]); + CHECK(expectedOutShapes[1] == actualOutShapes[1]); + CHECK(expectedOutShapes[2] == actualOutShapes[2]); } // QuantizedLstm @@ -624,9 +624,9 @@ void QuantizedLstmInferOutputShapeTest() }; std::vector<armnn::TensorShape> actualOutShapes; - BOOST_CHECK_NO_THROW(QuantizedLstmInferOutputShapeImpl(inShapes, actualOutShapes)); + CHECK_NOTHROW(QuantizedLstmInferOutputShapeImpl(inShapes, actualOutShapes)); - BOOST_CHECK(actualOutShapes.size() == 2); - BOOST_CHECK(expectedOutShapes[0] == actualOutShapes[0]); - BOOST_CHECK(expectedOutShapes[1] == actualOutShapes[1]); + CHECK(actualOutShapes.size() == 2); + CHECK(expectedOutShapes[0] == actualOutShapes[0]); + CHECK(expectedOutShapes[1] == actualOutShapes[1]); } |