diff options
author | Moritz Pflanzer <moritz.pflanzer@arm.com> | 2017-09-01 20:41:12 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:35:24 +0000 |
commit | a09de0c8b2ed0f1481502d3b023375609362d9e3 (patch) | |
tree | e34b56d9ca69b025d7d9b943cc4df59cd458f6cb /tests | |
parent | 5280071b336d53aff94ca3a6c70ebbe6bf03f4c3 (diff) | |
download | ComputeLibrary-a09de0c8b2ed0f1481502d3b023375609362d9e3.tar.gz |
COMPMID-415: Rename and move tests
The boost validation is now "standalone" in validation_old and builds as
arm_compute_validation_old. The new validation builds now as
arm_compute_validation.
Change-Id: Ib93ba848a25680ac60afb92b461d574a0757150d
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/86187
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/AssetsLibrary.cpp | 3 | ||||
-rw-r--r-- | tests/AssetsLibrary.h | 2 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 85 | ||||
-rw-r--r-- | tests/Globals.h | 2 | ||||
-rw-r--r-- | tests/RawTensor.h | 2 | ||||
-rw-r--r-- | tests/SConscript | 124 | ||||
-rw-r--r-- | tests/Utils.h | 2 | ||||
-rw-r--r-- | tests/benchmark/CL/ActivationLayer.cpp (renamed from tests/benchmark_new/CL/ActivationLayer.cpp) | 20 | ||||
-rw-r--r-- | tests/benchmark/CL/BatchNormalizationLayer.cpp (renamed from tests/benchmark_new/CL/BatchNormalizationLayer.cpp) | 10 | ||||
-rw-r--r-- | tests/benchmark/CL/ConvolutionLayer.cpp (renamed from tests/benchmark_new/CL/ConvolutionLayer.cpp) | 20 | ||||
-rw-r--r-- | tests/benchmark/CL/DepthwiseConvolution.cpp (renamed from tests/benchmark_new/CL/DepthwiseConvolution.cpp) | 8 | ||||
-rw-r--r-- | tests/benchmark/CL/DepthwiseSeparableConvolutionLayer.cpp (renamed from tests/benchmark_new/CL/DepthwiseSeparableConvolutionLayer.cpp) | 8 | ||||
-rw-r--r-- | tests/benchmark/CL/DirectConvolutionLayer.cpp (renamed from tests/benchmark_new/CL/DirectConvolutionLayer.cpp) | 18 | ||||
-rw-r--r-- | tests/benchmark/CL/Floor.cpp (renamed from tests/benchmark_new/CL/Floor.cpp) | 8 | ||||
-rw-r--r-- | tests/benchmark/CL/FullyConnectedLayer.cpp (renamed from tests/benchmark_new/CL/FullyConnectedLayer.cpp) | 16 | ||||
-rw-r--r-- | tests/benchmark/CL/GEMM.cpp (renamed from tests/benchmark_new/CL/GEMM.cpp) | 10 | ||||
-rw-r--r-- | tests/benchmark/CL/NormalizationLayer.cpp (renamed from tests/benchmark_new/CL/NormalizationLayer.cpp) | 10 | ||||
-rw-r--r-- | tests/benchmark/CL/PoolingLayer.cpp (renamed from tests/benchmark_new/CL/PoolingLayer.cpp) | 20 | ||||
-rw-r--r-- | tests/benchmark/CL/ROIPoolingLayer.cpp (renamed from tests/benchmark_new/CL/ROIPoolingLayer.cpp) | 8 | ||||
-rw-r--r-- | tests/benchmark/CL/SYSTEM/AlexNet.cpp (renamed from tests/benchmark_new/CL/SYSTEM/AlexNet.cpp) | 6 | ||||
-rw-r--r-- | tests/benchmark/CL/SYSTEM/LeNet5.cpp (renamed from tests/benchmark_new/CL/SYSTEM/LeNet5.cpp) | 6 | ||||
-rw-r--r-- | tests/benchmark/NEON/ActivationLayer.cpp (renamed from tests/benchmark_new/NEON/ActivationLayer.cpp) | 20 | ||||
-rw-r--r-- | tests/benchmark/NEON/BatchNormalizationLayer.cpp (renamed from tests/benchmark_new/NEON/BatchNormalizationLayer.cpp) | 10 | ||||
-rw-r--r-- | tests/benchmark/NEON/ConvolutionLayer.cpp (renamed from tests/benchmark_new/NEON/ConvolutionLayer.cpp) | 20 | ||||
-rw-r--r-- | tests/benchmark/NEON/DirectConvolutionLayer.cpp (renamed from tests/benchmark_new/NEON/DirectConvolutionLayer.cpp) | 20 | ||||
-rw-r--r-- | tests/benchmark/NEON/Floor.cpp (renamed from tests/benchmark_new/NEON/Floor.cpp) | 8 | ||||
-rw-r--r-- | tests/benchmark/NEON/FullyConnectedLayer.cpp (renamed from tests/benchmark_new/NEON/FullyConnectedLayer.cpp) | 16 | ||||
-rw-r--r-- | tests/benchmark/NEON/GEMM.cpp (renamed from tests/benchmark_new/NEON/GEMM.cpp) | 10 | ||||
-rw-r--r-- | tests/benchmark/NEON/NormalizationLayer.cpp (renamed from tests/benchmark_new/NEON/NormalizationLayer.cpp) | 10 | ||||
-rw-r--r-- | tests/benchmark/NEON/PoolingLayer.cpp (renamed from tests/benchmark_new/NEON/PoolingLayer.cpp) | 20 | ||||
-rw-r--r-- | tests/benchmark/NEON/ROIPoolingLayer.cpp (renamed from tests/benchmark_new/NEON/ROIPoolingLayer.cpp) | 8 | ||||
-rw-r--r-- | tests/benchmark/NEON/SYSTEM/AlexNet.cpp (renamed from tests/benchmark_new/NEON/SYSTEM/AlexNet.cpp) | 6 | ||||
-rw-r--r-- | tests/benchmark/NEON/SYSTEM/LeNet5.cpp (renamed from tests/benchmark_new/NEON/SYSTEM/LeNet5.cpp) | 6 | ||||
-rw-r--r-- | tests/benchmark/fixtures/ActivationLayerFixture.h (renamed from tests/fixtures_new/ActivationLayerFixture.h) | 2 | ||||
-rw-r--r-- | tests/benchmark/fixtures/AlexNetFixture.h (renamed from tests/fixtures_new/AlexNetFixture.h) | 4 | ||||
-rw-r--r-- | tests/benchmark/fixtures/BatchNormalizationLayerFixture.h (renamed from tests/fixtures_new/BatchNormalizationLayerFixture.h) | 2 | ||||
-rw-r--r-- | tests/benchmark/fixtures/ConvolutionLayerFixture.h (renamed from tests/fixtures_new/ConvolutionLayerFixture.h) | 2 | ||||
-rw-r--r-- | tests/benchmark/fixtures/DepthwiseConvolutionFixture.h (renamed from tests/fixtures_new/DepthwiseConvolutionFixture.h) | 2 | ||||
-rw-r--r-- | tests/benchmark/fixtures/DepthwiseSeparableConvolutionLayerFixture.h (renamed from tests/fixtures_new/DepthwiseSeparableConvolutionLayerFixture.h) | 2 | ||||
-rw-r--r-- | tests/benchmark/fixtures/FloorFixture.h (renamed from tests/fixtures_new/FloorFixture.h) | 2 | ||||
-rw-r--r-- | tests/benchmark/fixtures/FullyConnectedLayerFixture.h (renamed from tests/fixtures_new/FullyConnectedLayerFixture.h) | 2 | ||||
-rw-r--r-- | tests/benchmark/fixtures/GEMMFixture.h (renamed from tests/fixtures_new/GEMMFixture.h) | 2 | ||||
-rw-r--r-- | tests/benchmark/fixtures/LeNet5Fixture.h (renamed from tests/fixtures_new/LeNet5Fixture.h) | 4 | ||||
-rw-r--r-- | tests/benchmark/fixtures/NormalizationLayerFixture.h (renamed from tests/fixtures_new/NormalizationLayerFixture.h) | 2 | ||||
-rw-r--r-- | tests/benchmark/fixtures/PoolingLayerFixture.h (renamed from tests/fixtures_new/PoolingLayerFixture.h) | 2 | ||||
-rw-r--r-- | tests/benchmark/fixtures/ROIPoolingLayerFixture.h (renamed from tests/fixtures_new/ROIPoolingLayerFixture.h) | 2 | ||||
-rw-r--r-- | tests/datasets/ActivationFunctionsDataset.h (renamed from tests/datasets_new/ActivationFunctionsDataset.h) | 3 | ||||
-rw-r--r-- | tests/datasets/BatchNormalizationLayerDataset.h (renamed from tests/datasets_new/BatchNormalizationLayerDataset.h) | 0 | ||||
-rw-r--r-- | tests/datasets/BorderModeDataset.h (renamed from tests/datasets_new/BorderModeDataset.h) | 3 | ||||
-rw-r--r-- | tests/datasets/ConvolutionLayerDataset.h (renamed from tests/datasets_new/ConvolutionLayerDataset.h) | 0 | ||||
-rw-r--r-- | tests/datasets/DepthwiseConvolutionDataset.h (renamed from tests/datasets_new/DepthwiseConvolutionDataset.h) | 0 | ||||
-rw-r--r-- | tests/datasets/DepthwiseSeparableConvolutionLayerDataset.h (renamed from tests/datasets_new/DepthwiseSeparableConvolutionLayerDataset.h) | 0 | ||||
-rw-r--r-- | tests/datasets/DirectConvolutionLayerDataset.h (renamed from tests/datasets_new/DirectConvolutionLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/FullyConnectedLayerDataset.h (renamed from tests/datasets_new/FullyConnectedLayerDataset.h) | 0 | ||||
-rw-r--r-- | tests/datasets/GEMMDataset.h (renamed from tests/datasets_new/GEMMDataset.h) | 0 | ||||
-rw-r--r-- | tests/datasets/InterpolationPolicyDataset.h (renamed from tests/datasets_new/InterpolationPolicyDataset.h) | 0 | ||||
-rw-r--r-- | tests/datasets/LargeConvolutionLayerDataset.h (renamed from tests/datasets_new/LargeConvolutionLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/LargeDepthwiseConvolutionDataset.h (renamed from tests/datasets_new/LargeDepthwiseConvolutionDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/LargeGEMMDataset.h (renamed from tests/datasets_new/LargeGEMMDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/MatrixMultiplyGEMMDataset.h (renamed from tests/datasets_new/MatrixMultiplyGEMMDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/MobileNetDepthwiseConvolutionDataset.h (renamed from tests/datasets_new/MobileNetDepthwiseConvolutionDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/MobileNetDepthwiseSeparableConvolutionLayerDataset.h (renamed from tests/datasets_new/MobileNetDepthwiseSeparableConvolutionLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/NormalizationTypesDataset.h (renamed from tests/datasets_new/NormalizationTypesDataset.h) | 3 | ||||
-rw-r--r-- | tests/datasets/PoolingLayerDataset.h (renamed from tests/datasets_new/PoolingLayerDataset.h) | 3 | ||||
-rw-r--r-- | tests/datasets/PoolingTypesDataset.h (renamed from tests/datasets_new/PoolingTypesDataset.h) | 3 | ||||
-rw-r--r-- | tests/datasets/ROIPoolingLayerDataset.h (renamed from tests/datasets_new/ROIPoolingLayerDataset.h) | 0 | ||||
-rw-r--r-- | tests/datasets/ReductionOperationDataset.h (renamed from tests/datasets_new/ReductionOperationDataset.h) | 3 | ||||
-rw-r--r-- | tests/datasets/ShapeDatasets.h (renamed from tests/datasets_new/ShapeDatasets.h) | 2 | ||||
-rw-r--r-- | tests/datasets/SmallConvolutionLayerDataset.h (renamed from tests/datasets_new/SmallConvolutionLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/SmallDepthwiseConvolutionDataset.h (renamed from tests/datasets_new/SmallDepthwiseConvolutionDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/SmallGEMMDataset.h (renamed from tests/datasets_new/SmallGEMMDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/alexnet/AlexNetActivationLayerDataset.h (renamed from tests/datasets_new/system_tests/alexnet/AlexNetActivationLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h (renamed from tests/datasets_new/system_tests/alexnet/AlexNetConvolutionLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/alexnet/AlexNetFullyConnectedLayerDataset.h (renamed from tests/datasets_new/system_tests/alexnet/AlexNetFullyConnectedLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/alexnet/AlexNetNormalizationLayerDataset.h (renamed from tests/datasets_new/system_tests/alexnet/AlexNetNormalizationLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/alexnet/AlexNetPoolingLayerDataset.h (renamed from tests/datasets_new/system_tests/alexnet/AlexNetPoolingLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ActivationLayerDataset.h (renamed from tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ActivationLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h (renamed from tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1FullyConnectedLayerDataset.h (renamed from tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1FullyConnectedLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1GEMMDataset.h (renamed from tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1GEMMDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1NormalizationLayerDataset.h (renamed from tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1NormalizationLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1PoolingLayerDataset.h (renamed from tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1PoolingLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ActivationLayerDataset.h (renamed from tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ActivationLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4BatchNormalizationLayerDataset.h (renamed from tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4BatchNormalizationLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h (renamed from tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4FullyConnectedLayerDataset.h (renamed from tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4FullyConnectedLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h (renamed from tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/lenet5/LeNet5ActivationLayerDataset.h (renamed from tests/datasets_new/system_tests/lenet5/LeNet5ActivationLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/lenet5/LeNet5ConvolutionLayerDataset.h (renamed from tests/datasets_new/system_tests/lenet5/LeNet5ConvolutionLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/lenet5/LeNet5FullyConnectedLayerDataset.h (renamed from tests/datasets_new/system_tests/lenet5/LeNet5FullyConnectedLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/lenet5/LeNet5PoolingLayerDataset.h (renamed from tests/datasets_new/system_tests/lenet5/LeNet5PoolingLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/squeezenet/SqueezeNetActivationLayerDataset.h (renamed from tests/datasets_new/system_tests/squeezenet/SqueezeNetActivationLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h (renamed from tests/datasets_new/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/squeezenet/SqueezeNetPoolingLayerDataset.h (renamed from tests/datasets_new/system_tests/squeezenet/SqueezeNetPoolingLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/vgg/vgg16/VGG16ActivationLayerDataset.h (renamed from tests/datasets_new/system_tests/vgg/vgg16/VGG16ActivationLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h (renamed from tests/datasets_new/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/vgg/vgg16/VGG16FullyConnectedLayerDataset.h (renamed from tests/datasets_new/system_tests/vgg/vgg16/VGG16FullyConnectedLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/vgg/vgg16/VGG16PoolingLayerDataset.h (renamed from tests/datasets_new/system_tests/vgg/vgg16/VGG16PoolingLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/yolo/v2/YOLOV2ActivationLayerDataset.h (renamed from tests/datasets_new/system_tests/yolo/v2/YOLOV2ActivationLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/yolo/v2/YOLOV2BatchNormalizationLayerDataset.h (renamed from tests/datasets_new/system_tests/yolo/v2/YOLOV2BatchNormalizationLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h (renamed from tests/datasets_new/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/datasets/system_tests/yolo/v2/YOLOV2PoolingLayerDataset.h (renamed from tests/datasets_new/system_tests/yolo/v2/YOLOV2PoolingLayerDataset.h) | 2 | ||||
-rw-r--r-- | tests/framework/Asserts.h | 132 | ||||
-rw-r--r-- | tests/framework/DatasetModes.cpp | 56 | ||||
-rw-r--r-- | tests/framework/DatasetModes.h | 106 | ||||
-rw-r--r-- | tests/framework/Exceptions.cpp | 128 | ||||
-rw-r--r-- | tests/framework/Exceptions.h | 97 | ||||
-rw-r--r-- | tests/framework/Fixture.h | 63 | ||||
-rw-r--r-- | tests/framework/Framework.cpp | 494 | ||||
-rw-r--r-- | tests/framework/Framework.h | 330 | ||||
-rw-r--r-- | tests/framework/Macros.h | 260 | ||||
-rw-r--r-- | tests/framework/Profiler.cpp | 67 | ||||
-rw-r--r-- | tests/framework/Profiler.h | 75 | ||||
-rw-r--r-- | tests/framework/Registrars.h | 113 | ||||
-rw-r--r-- | tests/framework/SConscript | 71 | ||||
-rw-r--r-- | tests/framework/TestCase.h | 70 | ||||
-rw-r--r-- | tests/framework/TestCaseFactory.h | 202 | ||||
-rw-r--r-- | tests/framework/TestFilter.cpp | 143 | ||||
-rw-r--r-- | tests/framework/TestFilter.h | 84 | ||||
-rw-r--r-- | tests/framework/TestResult.h | 80 | ||||
-rw-r--r-- | tests/framework/Utils.h | 158 | ||||
-rw-r--r-- | tests/framework/command_line/CommandLineOptions.h | 33 | ||||
-rw-r--r-- | tests/framework/command_line/CommandLineParser.cpp | 149 | ||||
-rw-r--r-- | tests/framework/command_line/CommandLineParser.h | 117 | ||||
-rw-r--r-- | tests/framework/command_line/EnumListOption.h | 148 | ||||
-rw-r--r-- | tests/framework/command_line/EnumOption.h | 134 | ||||
-rw-r--r-- | tests/framework/command_line/ListOption.h | 116 | ||||
-rw-r--r-- | tests/framework/command_line/Option.cpp | 68 | ||||
-rw-r--r-- | tests/framework/command_line/Option.h | 109 | ||||
-rw-r--r-- | tests/framework/command_line/SimpleOption.h | 105 | ||||
-rw-r--r-- | tests/framework/command_line/ToggleOption.cpp | 64 | ||||
-rw-r--r-- | tests/framework/command_line/ToggleOption.h | 56 | ||||
-rw-r--r-- | tests/framework/datasets/CartesianProductDataset.h | 165 | ||||
-rw-r--r-- | tests/framework/datasets/ContainerDataset.h | 148 | ||||
-rw-r--r-- | tests/framework/datasets/Dataset.h | 86 | ||||
-rw-r--r-- | tests/framework/datasets/Datasets.h | 35 | ||||
-rw-r--r-- | tests/framework/datasets/InitializerListDataset.h | 135 | ||||
-rw-r--r-- | tests/framework/datasets/JoinDataset.h | 148 | ||||
-rw-r--r-- | tests/framework/datasets/RangeDataset.h | 141 | ||||
-rw-r--r-- | tests/framework/datasets/SingletonDataset.h | 138 | ||||
-rw-r--r-- | tests/framework/datasets/ZipDataset.h | 139 | ||||
-rw-r--r-- | tests/framework/instruments/Instrument.h | 98 | ||||
-rw-r--r-- | tests/framework/instruments/Instruments.cpp | 59 | ||||
-rw-r--r-- | tests/framework/instruments/Instruments.h | 105 | ||||
-rw-r--r-- | tests/framework/instruments/PMUCounter.cpp | 140 | ||||
-rw-r--r-- | tests/framework/instruments/PMUCounter.h | 71 | ||||
-rw-r--r-- | tests/framework/instruments/WallClockTimer.cpp | 57 | ||||
-rw-r--r-- | tests/framework/instruments/WallClockTimer.h | 53 | ||||
-rw-r--r-- | tests/framework/printers/JSONPrinter.cpp | 168 | ||||
-rw-r--r-- | tests/framework/printers/JSONPrinter.h | 64 | ||||
-rw-r--r-- | tests/framework/printers/PrettyPrinter.cpp | 140 | ||||
-rw-r--r-- | tests/framework/printers/PrettyPrinter.h | 69 | ||||
-rw-r--r-- | tests/framework/printers/Printer.cpp | 48 | ||||
-rw-r--r-- | tests/framework/printers/Printer.h | 129 | ||||
-rw-r--r-- | tests/framework/printers/Printers.cpp | 57 | ||||
-rw-r--r-- | tests/framework/printers/Printers.h | 75 | ||||
-rw-r--r-- | tests/main.cpp | 16 | ||||
-rw-r--r-- | tests/networks/AlexNetNetwork.h (renamed from tests/networks_new/AlexNetNetwork.h) | 6 | ||||
-rw-r--r-- | tests/networks/LeNet5Network.h (renamed from tests/networks_new/LeNet5Network.h) | 6 | ||||
-rw-r--r-- | tests/validation/CL/ActivationLayer.cpp (renamed from tests/validation_new/CL/ActivationLayer.cpp) | 16 | ||||
-rw-r--r-- | tests/validation/CL/BitwiseAnd.cpp (renamed from tests/validation_new/CL/BitwiseAnd.cpp) | 12 | ||||
-rw-r--r-- | tests/validation/CL/BitwiseNot.cpp (renamed from tests/validation_new/CL/BitwiseNot.cpp) | 12 | ||||
-rw-r--r-- | tests/validation/CL/BitwiseOr.cpp (renamed from tests/validation_new/CL/BitwiseOr.cpp) | 12 | ||||
-rw-r--r-- | tests/validation/CL/BitwiseXor.cpp (renamed from tests/validation_new/CL/BitwiseXor.cpp) | 12 | ||||
-rw-r--r-- | tests/validation/CL/CMakeLists.txt | 68 | ||||
-rw-r--r-- | tests/validation/CL/ConvolutionLayer.cpp (renamed from tests/validation_new/CL/ConvolutionLayer.cpp) | 16 | ||||
-rw-r--r-- | tests/validation/CL/DepthConcatenateLayer.cpp (renamed from tests/validation_new/CL/DepthConcatenateLayer.cpp) | 14 | ||||
-rw-r--r-- | tests/validation/CL/DepthwiseConvolution.cpp (renamed from tests/validation_new/CL/DepthwiseConvolution.cpp) | 14 | ||||
-rw-r--r-- | tests/validation/CL/DepthwiseSeparableConvolutionLayer.cpp (renamed from tests/validation_new/CL/DepthwiseSeparableConvolutionLayer.cpp) | 12 | ||||
-rw-r--r-- | tests/validation/CL/DirectConvolutionLayer.cpp (renamed from tests/validation_new/CL/DirectConvolutionLayer.cpp) | 14 | ||||
-rw-r--r-- | tests/validation/CL/Floor.cpp (renamed from tests/validation_new/CL/Floor.cpp) | 12 | ||||
-rw-r--r-- | tests/validation/CL/FullyConnectedLayer.cpp (renamed from tests/validation_new/CL/FullyConnectedLayer.cpp) | 14 | ||||
-rw-r--r-- | tests/validation/CL/GEMM.cpp (renamed from tests/validation_new/CL/GEMM.cpp) | 16 | ||||
-rw-r--r-- | tests/validation/CL/L2Normalize.cpp (renamed from tests/validation_new/CL/L2Normalize.cpp) | 14 | ||||
-rw-r--r-- | tests/validation/CL/MeanStdDev.cpp (renamed from tests/validation_new/CL/MeanStdDev.cpp) | 8 | ||||
-rw-r--r-- | tests/validation/CL/NormalizationLayer.cpp (renamed from tests/validation_new/CL/NormalizationLayer.cpp) | 16 | ||||
-rw-r--r-- | tests/validation/CL/PoolingLayer.cpp (renamed from tests/validation_new/CL/PoolingLayer.cpp) | 16 | ||||
-rw-r--r-- | tests/validation/CL/ReductionOperation.cpp (renamed from tests/validation_new/CL/ReductionOperation.cpp) | 16 | ||||
-rw-r--r-- | tests/validation/CL/Scale.cpp (renamed from tests/validation_new/CL/Scale.cpp) | 16 | ||||
-rw-r--r-- | tests/validation/CL/SoftmaxLayer.cpp (renamed from tests/validation_new/CL/SoftmaxLayer.cpp) | 14 | ||||
-rw-r--r-- | tests/validation/CMakeLists.txt | 96 | ||||
-rw-r--r-- | tests/validation/CPP/ActivationLayer.cpp (renamed from tests/validation_new/CPP/ActivationLayer.cpp) | 6 | ||||
-rw-r--r-- | tests/validation/CPP/ActivationLayer.h (renamed from tests/validation_new/CPP/ActivationLayer.h) | 2 | ||||
-rw-r--r-- | tests/validation/CPP/BitwiseAnd.cpp (renamed from tests/validation_new/CPP/BitwiseAnd.cpp) | 0 | ||||
-rw-r--r-- | tests/validation/CPP/BitwiseAnd.h (renamed from tests/validation_new/CPP/BitwiseAnd.h) | 0 | ||||
-rw-r--r-- | tests/validation/CPP/BitwiseNot.cpp (renamed from tests/validation_new/CPP/BitwiseNot.cpp) | 0 | ||||
-rw-r--r-- | tests/validation/CPP/BitwiseNot.h (renamed from tests/validation_new/CPP/BitwiseNot.h) | 0 | ||||
-rw-r--r-- | tests/validation/CPP/BitwiseOr.cpp (renamed from tests/validation_new/CPP/BitwiseOr.cpp) | 0 | ||||
-rw-r--r-- | tests/validation/CPP/BitwiseOr.h (renamed from tests/validation_new/CPP/BitwiseOr.h) | 0 | ||||
-rw-r--r-- | tests/validation/CPP/BitwiseXor.cpp (renamed from tests/validation_new/CPP/BitwiseXor.cpp) | 0 | ||||
-rw-r--r-- | tests/validation/CPP/BitwiseXor.h (renamed from tests/validation_new/CPP/BitwiseXor.h) | 0 | ||||
-rw-r--r-- | tests/validation/CPP/ConvolutionLayer.cpp (renamed from tests/validation_new/CPP/ConvolutionLayer.cpp) | 6 | ||||
-rw-r--r-- | tests/validation/CPP/ConvolutionLayer.h (renamed from tests/validation_new/CPP/ConvolutionLayer.h) | 2 | ||||
-rw-r--r-- | tests/validation/CPP/DepthConcatenateLayer.cpp (renamed from tests/validation_new/CPP/DepthConcatenateLayer.cpp) | 6 | ||||
-rw-r--r-- | tests/validation/CPP/DepthConcatenateLayer.h (renamed from tests/validation_new/CPP/DepthConcatenateLayer.h) | 0 | ||||
-rw-r--r-- | tests/validation/CPP/DepthwiseConvolution.cpp (renamed from tests/validation_new/CPP/DepthwiseConvolution.cpp) | 4 | ||||
-rw-r--r-- | tests/validation/CPP/DepthwiseConvolution.h (renamed from tests/validation_new/CPP/DepthwiseConvolution.h) | 2 | ||||
-rw-r--r-- | tests/validation/CPP/DepthwiseSeparableConvolutionLayer.cpp (renamed from tests/validation_new/CPP/DepthwiseSeparableConvolutionLayer.cpp) | 4 | ||||
-rw-r--r-- | tests/validation/CPP/DepthwiseSeparableConvolutionLayer.h (renamed from tests/validation_new/CPP/DepthwiseSeparableConvolutionLayer.h) | 2 | ||||
-rw-r--r-- | tests/validation/CPP/DequantizationLayer.cpp (renamed from tests/validation_new/CPP/DequantizationLayer.cpp) | 0 | ||||
-rw-r--r-- | tests/validation/CPP/DequantizationLayer.h (renamed from tests/validation_new/CPP/DequantizationLayer.h) | 2 | ||||
-rw-r--r-- | tests/validation/CPP/Floor.cpp (renamed from tests/validation_new/CPP/Floor.cpp) | 2 | ||||
-rw-r--r-- | tests/validation/CPP/Floor.h (renamed from tests/validation_new/CPP/Floor.h) | 2 | ||||
-rw-r--r-- | tests/validation/CPP/FullyConnectedLayer.cpp (renamed from tests/validation_new/CPP/FullyConnectedLayer.cpp) | 4 | ||||
-rw-r--r-- | tests/validation/CPP/FullyConnectedLayer.h (renamed from tests/validation_new/CPP/FullyConnectedLayer.h) | 2 | ||||
-rw-r--r-- | tests/validation/CPP/GEMM.cpp (renamed from tests/validation_new/CPP/GEMM.cpp) | 4 | ||||
-rw-r--r-- | tests/validation/CPP/GEMM.h (renamed from tests/validation_new/CPP/GEMM.h) | 2 | ||||
-rw-r--r-- | tests/validation/CPP/L2Normalize.cpp (renamed from tests/validation_new/CPP/L2Normalize.cpp) | 2 | ||||
-rw-r--r-- | tests/validation/CPP/L2Normalize.h (renamed from tests/validation_new/CPP/L2Normalize.h) | 2 | ||||
-rw-r--r-- | tests/validation/CPP/MeanStdDev.cpp (renamed from tests/validation_new/CPP/MeanStdDev.cpp) | 0 | ||||
-rw-r--r-- | tests/validation/CPP/MeanStdDev.h (renamed from tests/validation_new/CPP/MeanStdDev.h) | 0 | ||||
-rw-r--r-- | tests/validation/CPP/NormalizationLayer.cpp (renamed from tests/validation_new/CPP/NormalizationLayer.cpp) | 4 | ||||
-rw-r--r-- | tests/validation/CPP/NormalizationLayer.h (renamed from tests/validation_new/CPP/NormalizationLayer.h) | 2 | ||||
-rw-r--r-- | tests/validation/CPP/PoolingLayer.cpp (renamed from tests/validation_new/CPP/PoolingLayer.cpp) | 4 | ||||
-rw-r--r-- | tests/validation/CPP/PoolingLayer.h (renamed from tests/validation_new/CPP/PoolingLayer.h) | 2 | ||||
-rw-r--r-- | tests/validation/CPP/QuantizationLayer.cpp (renamed from tests/validation_new/CPP/QuantizationLayer.cpp) | 0 | ||||
-rw-r--r-- | tests/validation/CPP/QuantizationLayer.h (renamed from tests/validation_new/CPP/QuantizationLayer.h) | 2 | ||||
-rw-r--r-- | tests/validation/CPP/ReductionOperation.cpp (renamed from tests/validation_new/CPP/ReductionOperation.cpp) | 2 | ||||
-rw-r--r-- | tests/validation/CPP/ReductionOperation.h (renamed from tests/validation_new/CPP/ReductionOperation.h) | 2 | ||||
-rw-r--r-- | tests/validation/CPP/Scale.cpp (renamed from tests/validation_new/CPP/Scale.cpp) | 0 | ||||
-rw-r--r-- | tests/validation/CPP/Scale.h (renamed from tests/validation_new/CPP/Scale.h) | 0 | ||||
-rw-r--r-- | tests/validation/CPP/SoftmaxLayer.cpp (renamed from tests/validation_new/CPP/SoftmaxLayer.cpp) | 4 | ||||
-rw-r--r-- | tests/validation/CPP/SoftmaxLayer.h (renamed from tests/validation_new/CPP/SoftmaxLayer.h) | 2 | ||||
-rw-r--r-- | tests/validation/CPP/Utils.cpp (renamed from tests/validation_new/CPP/Utils.cpp) | 4 | ||||
-rw-r--r-- | tests/validation/CPP/Utils.h (renamed from tests/validation_new/CPP/Utils.h) | 2 | ||||
-rw-r--r-- | tests/validation/FixedPoint.h | 86 | ||||
-rw-r--r-- | tests/validation/Helpers.cpp (renamed from tests/validation_new/Helpers.cpp) | 2 | ||||
-rw-r--r-- | tests/validation/Helpers.h | 259 | ||||
-rw-r--r-- | tests/validation/NEON/ActivationLayer.cpp (renamed from tests/validation_new/NEON/ActivationLayer.cpp) | 16 | ||||
-rw-r--r-- | tests/validation/NEON/BitwiseAnd.cpp (renamed from tests/validation_new/NEON/BitwiseAnd.cpp) | 12 | ||||
-rw-r--r-- | tests/validation/NEON/BitwiseNot.cpp (renamed from tests/validation_new/NEON/BitwiseNot.cpp) | 12 | ||||
-rw-r--r-- | tests/validation/NEON/BitwiseOr.cpp (renamed from tests/validation_new/NEON/BitwiseOr.cpp) | 12 | ||||
-rw-r--r-- | tests/validation/NEON/BitwiseXor.cpp (renamed from tests/validation_new/NEON/BitwiseXor.cpp) | 12 | ||||
-rw-r--r-- | tests/validation/NEON/CMakeLists.txt | 71 | ||||
-rw-r--r-- | tests/validation/NEON/ConvolutionLayer.cpp (renamed from tests/validation_new/NEON/ConvolutionLayer.cpp) | 16 | ||||
-rw-r--r-- | tests/validation/NEON/DepthConcatenateLayer.cpp (renamed from tests/validation_new/NEON/DepthConcatenateLayer.cpp) | 14 | ||||
-rw-r--r-- | tests/validation/NEON/DequantizationLayer.cpp (renamed from tests/validation_new/NEON/DequantizationLayer.cpp) | 12 | ||||
-rw-r--r-- | tests/validation/NEON/DirectConvolutionLayer.cpp (renamed from tests/validation_new/NEON/DirectConvolutionLayer.cpp) | 14 | ||||
-rw-r--r-- | tests/validation/NEON/Floor.cpp (renamed from tests/validation_new/NEON/Floor.cpp) | 12 | ||||
-rw-r--r-- | tests/validation/NEON/FullyConnectedLayer.cpp (renamed from tests/validation_new/NEON/FullyConnectedLayer.cpp) | 14 | ||||
-rw-r--r-- | tests/validation/NEON/GEMM.cpp (renamed from tests/validation_new/NEON/GEMM.cpp) | 16 | ||||
-rw-r--r-- | tests/validation/NEON/L2Normalize.cpp (renamed from tests/validation_new/NEON/L2Normalize.cpp) | 12 | ||||
-rw-r--r-- | tests/validation/NEON/MeanStdDev.cpp (renamed from tests/validation_new/NEON/MeanStdDev.cpp) | 8 | ||||
-rw-r--r-- | tests/validation/NEON/NormalizationLayer.cpp (renamed from tests/validation_new/NEON/NormalizationLayer.cpp) | 16 | ||||
-rw-r--r-- | tests/validation/NEON/PoolingLayer.cpp (renamed from tests/validation_new/NEON/PoolingLayer.cpp) | 16 | ||||
-rw-r--r-- | tests/validation/NEON/QuantizationLayer.cpp (renamed from tests/validation_new/NEON/QuantizationLayer.cpp) | 12 | ||||
-rw-r--r-- | tests/validation/NEON/ReductionOperation.cpp (renamed from tests/validation_new/NEON/ReductionOperation.cpp) | 14 | ||||
-rw-r--r-- | tests/validation/NEON/Scale.cpp (renamed from tests/validation_new/NEON/Scale.cpp) | 18 | ||||
-rw-r--r-- | tests/validation/NEON/SoftmaxLayer.cpp (renamed from tests/validation_new/NEON/SoftmaxLayer.cpp) | 14 | ||||
-rw-r--r-- | tests/validation/UNIT/CMakeLists.txt | 37 | ||||
-rw-r--r-- | tests/validation/Validation.cpp | 284 | ||||
-rw-r--r-- | tests/validation/Validation.h | 282 | ||||
-rw-r--r-- | tests/validation/fixtures/ActivationLayerFixture.h (renamed from tests/validation_new/fixtures/ActivationLayerFixture.h) | 8 | ||||
-rw-r--r-- | tests/validation/fixtures/BitwiseAndFixture.h (renamed from tests/validation_new/fixtures/BitwiseAndFixture.h) | 6 | ||||
-rw-r--r-- | tests/validation/fixtures/BitwiseNotFixture.h (renamed from tests/validation_new/fixtures/BitwiseNotFixture.h) | 6 | ||||
-rw-r--r-- | tests/validation/fixtures/BitwiseOrFixture.h (renamed from tests/validation_new/fixtures/BitwiseOrFixture.h) | 6 | ||||
-rw-r--r-- | tests/validation/fixtures/BitwiseXorFixture.h (renamed from tests/validation_new/fixtures/BitwiseXorFixture.h) | 6 | ||||
-rw-r--r-- | tests/validation/fixtures/ConvolutionLayerFixture.h (renamed from tests/validation_new/fixtures/ConvolutionLayerFixture.h) | 8 | ||||
-rw-r--r-- | tests/validation/fixtures/DepthConcatenateLayerFixture.h (renamed from tests/validation_new/fixtures/DepthConcatenateLayerFixture.h) | 8 | ||||
-rw-r--r-- | tests/validation/fixtures/DepthwiseConvolutionFixture.h (renamed from tests/validation_new/fixtures/DepthwiseConvolutionFixture.h) | 8 | ||||
-rw-r--r-- | tests/validation/fixtures/DepthwiseSeparableConvolutionLayerFixture.h (renamed from tests/validation_new/fixtures/DepthwiseSeparableConvolutionLayerFixture.h) | 8 | ||||
-rw-r--r-- | tests/validation/fixtures/DequantizationLayerFixture.h (renamed from tests/validation_new/fixtures/DequantizationLayerFixture.h) | 6 | ||||
-rw-r--r-- | tests/validation/fixtures/DirectConvolutionLayerFixture.h (renamed from tests/validation_new/fixtures/DirectConvolutionLayerFixture.h) | 10 | ||||
-rw-r--r-- | tests/validation/fixtures/FloorFixture.h (renamed from tests/validation_new/fixtures/FloorFixture.h) | 6 | ||||
-rw-r--r-- | tests/validation/fixtures/FullyConnectedLayerFixture.h (renamed from tests/validation_new/fixtures/FullyConnectedLayerFixture.h) | 8 | ||||
-rw-r--r-- | tests/validation/fixtures/GEMMFixture.h (renamed from tests/validation_new/fixtures/GEMMFixture.h) | 8 | ||||
-rw-r--r-- | tests/validation/fixtures/L2NormalizeFixture.h (renamed from tests/validation_new/fixtures/L2NormalizeFixture.h) | 6 | ||||
-rw-r--r-- | tests/validation/fixtures/MeanStdDevFixture.h (renamed from tests/validation_new/fixtures/MeanStdDevFixture.h) | 6 | ||||
-rw-r--r-- | tests/validation/fixtures/NormalizationLayerFixture.h (renamed from tests/validation_new/fixtures/NormalizationLayerFixture.h) | 6 | ||||
-rw-r--r-- | tests/validation/fixtures/PoolingLayerFixture.h (renamed from tests/validation_new/fixtures/PoolingLayerFixture.h) | 6 | ||||
-rw-r--r-- | tests/validation/fixtures/QuantizationLayerFixture.h (renamed from tests/validation_new/fixtures/QuantizationLayerFixture.h) | 6 | ||||
-rw-r--r-- | tests/validation/fixtures/ReductionOperationFixture.h (renamed from tests/validation_new/fixtures/ReductionOperationFixture.h) | 6 | ||||
-rw-r--r-- | tests/validation/fixtures/ScaleFixture.h (renamed from tests/validation_new/fixtures/ScaleFixture.h) | 6 | ||||
-rw-r--r-- | tests/validation/fixtures/SoftmaxLayerFixture.h (renamed from tests/validation_new/fixtures/SoftmaxLayerFixture.h) | 6 | ||||
-rw-r--r-- | tests/validation/half.h | 1 | ||||
-rw-r--r-- | tests/validation_new/Helpers.h | 142 | ||||
-rw-r--r-- | tests/validation_new/Validation.cpp | 307 | ||||
-rw-r--r-- | tests/validation_new/Validation.h | 351 | ||||
-rw-r--r-- | tests/validation_old/AssetsLibrary.cpp | 447 | ||||
-rw-r--r-- | tests/validation_old/AssetsLibrary.h | 674 | ||||
-rw-r--r-- | tests/validation_old/CL/ArithmeticAddition.cpp (renamed from tests/validation/CL/ArithmeticAddition.cpp) | 10 | ||||
-rw-r--r-- | tests/validation_old/CL/ArithmeticSubtraction.cpp (renamed from tests/validation/CL/ArithmeticSubtraction.cpp) | 10 | ||||
-rw-r--r-- | tests/validation_old/CL/BatchNormalizationLayer.cpp (renamed from tests/validation/CL/BatchNormalizationLayer.cpp) | 14 | ||||
-rw-r--r-- | tests/validation_old/CL/Box3x3.cpp (renamed from tests/validation/CL/Box3x3.cpp) | 14 | ||||
-rw-r--r-- | tests/validation_old/CL/CLFixture.cpp (renamed from tests/validation/CL/CLFixture.cpp) | 4 | ||||
-rw-r--r-- | tests/validation_old/CL/CLFixture.h (renamed from tests/validation/CL/CLFixture.h) | 0 | ||||
-rw-r--r-- | tests/validation_old/CL/DepthConvert.cpp (renamed from tests/validation/CL/DepthConvert.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/CL/FillBorder.cpp (renamed from tests/validation/CL/FillBorder.cpp) | 10 | ||||
-rw-r--r-- | tests/validation_old/CL/FixedPoint/FixedPoint_QS8.cpp (renamed from tests/validation/CL/FixedPoint/FixedPoint_QS8.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/CL/Gaussian3x3.cpp (renamed from tests/validation/CL/Gaussian3x3.cpp) | 14 | ||||
-rw-r--r-- | tests/validation_old/CL/Gaussian5x5.cpp (renamed from tests/validation/CL/Gaussian5x5.cpp) | 14 | ||||
-rw-r--r-- | tests/validation_old/CL/HarrisCorners.cpp (renamed from tests/validation/CL/HarrisCorners.cpp) | 14 | ||||
-rw-r--r-- | tests/validation_old/CL/IntegralImage.cpp (renamed from tests/validation/CL/IntegralImage.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/CL/MinMaxLocation.cpp (renamed from tests/validation/CL/MinMaxLocation.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/CL/NonLinearFilter.cpp (renamed from tests/validation/CL/NonLinearFilter.cpp) | 16 | ||||
-rw-r--r-- | tests/validation_old/CL/PixelWiseMultiplication.cpp (renamed from tests/validation/CL/PixelWiseMultiplication.cpp) | 6 | ||||
-rw-r--r-- | tests/validation_old/CL/ROIPoolingLayer.cpp (renamed from tests/validation/CL/ROIPoolingLayer.cpp) | 8 | ||||
-rw-r--r-- | tests/validation_old/CL/Sobel3x3.cpp (renamed from tests/validation/CL/Sobel3x3.cpp) | 14 | ||||
-rw-r--r-- | tests/validation_old/CL/Sobel5x5.cpp (renamed from tests/validation/CL/Sobel5x5.cpp) | 14 | ||||
-rw-r--r-- | tests/validation_old/CL/TableLookup.cpp (renamed from tests/validation/CL/TableLookup.cpp) | 14 | ||||
-rw-r--r-- | tests/validation_old/CL/Threshold.cpp (renamed from tests/validation/CL/Threshold.cpp) | 14 | ||||
-rw-r--r-- | tests/validation_old/CL/WarpPerspective.cpp (renamed from tests/validation/CL/WarpPerspective.cpp) | 16 | ||||
-rw-r--r-- | tests/validation_old/Datasets.h (renamed from tests/validation/Datasets.h) | 38 | ||||
-rw-r--r-- | tests/validation_old/FixedPoint.h (renamed from tests/validation_new/FixedPoint.h) | 84 | ||||
-rw-r--r-- | tests/validation_old/Helpers.h | 273 | ||||
-rw-r--r-- | tests/validation_old/NEON/AbsoluteDifference.cpp (renamed from tests/validation/NEON/AbsoluteDifference.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/Accumulate.cpp (renamed from tests/validation/NEON/Accumulate.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/AccumulateSquared.cpp (renamed from tests/validation/NEON/AccumulateSquared.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/AccumulateWeighted.cpp (renamed from tests/validation/NEON/AccumulateWeighted.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/ArithmeticAddition.cpp (renamed from tests/validation/NEON/ArithmeticAddition.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/ArithmeticSubtraction.cpp (renamed from tests/validation/NEON/ArithmeticSubtraction.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/BatchNormalizationLayer.cpp (renamed from tests/validation/NEON/BatchNormalizationLayer.cpp) | 10 | ||||
-rw-r--r-- | tests/validation_old/NEON/Box3x3.cpp (renamed from tests/validation/NEON/Box3x3.cpp) | 14 | ||||
-rw-r--r-- | tests/validation_old/NEON/DepthConvert.cpp (renamed from tests/validation/NEON/DepthConvert.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/FillBorder.cpp (renamed from tests/validation/NEON/FillBorder.cpp) | 10 | ||||
-rw-r--r-- | tests/validation_old/NEON/Fixedpoint/Exp_QS16.cpp (renamed from tests/validation/NEON/Fixedpoint/Exp_QS16.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/Fixedpoint/Exp_QS8.cpp (renamed from tests/validation/NEON/Fixedpoint/Exp_QS8.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/Fixedpoint/Invsqrt_QS16.cpp (renamed from tests/validation/NEON/Fixedpoint/Invsqrt_QS16.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/Fixedpoint/Invsqrt_QS8.cpp (renamed from tests/validation/NEON/Fixedpoint/Invsqrt_QS8.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/Fixedpoint/Log_QS16.cpp (renamed from tests/validation/NEON/Fixedpoint/Log_QS16.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/Fixedpoint/Log_QS8.cpp (renamed from tests/validation/NEON/Fixedpoint/Log_QS8.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/Fixedpoint/Reciprocal_QS16.cpp (renamed from tests/validation/NEON/Fixedpoint/Reciprocal_QS16.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/Fixedpoint/Reciprocal_QS8.cpp (renamed from tests/validation/NEON/Fixedpoint/Reciprocal_QS8.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/Gaussian3x3.cpp (renamed from tests/validation/NEON/Gaussian3x3.cpp) | 14 | ||||
-rw-r--r-- | tests/validation_old/NEON/Gaussian5x5.cpp (renamed from tests/validation/NEON/Gaussian5x5.cpp) | 14 | ||||
-rw-r--r-- | tests/validation_old/NEON/HarrisCorners.cpp (renamed from tests/validation/NEON/HarrisCorners.cpp) | 14 | ||||
-rw-r--r-- | tests/validation_old/NEON/IntegralImage.cpp (renamed from tests/validation/NEON/IntegralImage.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/MinMaxLocation.cpp (renamed from tests/validation/NEON/MinMaxLocation.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/NonLinearFilter.cpp (renamed from tests/validation/NEON/NonLinearFilter.cpp) | 16 | ||||
-rw-r--r-- | tests/validation_old/NEON/PixelWiseMultiplication.cpp (renamed from tests/validation/NEON/PixelWiseMultiplication.cpp) | 12 | ||||
-rw-r--r-- | tests/validation_old/NEON/ROIPoolingLayer.cpp (renamed from tests/validation/NEON/ROIPoolingLayer.cpp) | 8 | ||||
-rw-r--r-- | tests/validation_old/NEON/Sobel3x3.cpp (renamed from tests/validation/NEON/Sobel3x3.cpp) | 14 | ||||
-rw-r--r-- | tests/validation_old/NEON/Sobel5x5.cpp (renamed from tests/validation/NEON/Sobel5x5.cpp) | 14 | ||||
-rw-r--r-- | tests/validation_old/NEON/TableLookup.cpp (renamed from tests/validation/NEON/TableLookup.cpp) | 14 | ||||
-rw-r--r-- | tests/validation_old/NEON/Threshold.cpp (renamed from tests/validation/NEON/Threshold.cpp) | 14 | ||||
-rw-r--r-- | tests/validation_old/NEON/WarpPerspective.cpp (renamed from tests/validation/NEON/WarpPerspective.cpp) | 16 | ||||
-rw-r--r-- | tests/validation_old/ProgramOptions.cpp (renamed from tests/ProgramOptions.cpp) | 0 | ||||
-rw-r--r-- | tests/validation_old/ProgramOptions.h (renamed from tests/ProgramOptions.h) | 0 | ||||
-rw-r--r-- | tests/validation_old/RawTensor.cpp | 67 | ||||
-rw-r--r-- | tests/validation_old/RawTensor.h | 86 | ||||
-rw-r--r-- | tests/validation_old/Reference.cpp (renamed from tests/validation/Reference.cpp) | 6 | ||||
-rw-r--r-- | tests/validation_old/Reference.h (renamed from tests/validation/Reference.h) | 0 | ||||
-rw-r--r-- | tests/validation_old/ReferenceCPP.cpp (renamed from tests/validation/ReferenceCPP.cpp) | 2 | ||||
-rw-r--r-- | tests/validation_old/ReferenceCPP.h (renamed from tests/validation/ReferenceCPP.h) | 0 | ||||
-rw-r--r-- | tests/validation_old/SConscript | 119 | ||||
-rw-r--r-- | tests/validation_old/Tensor.h (renamed from tests/validation/Tensor.h) | 0 | ||||
-rw-r--r-- | tests/validation_old/TensorFactory.h (renamed from tests/validation/TensorFactory.h) | 6 | ||||
-rw-r--r-- | tests/validation_old/TensorOperations.h (renamed from tests/validation/TensorOperations.h) | 8 | ||||
-rw-r--r-- | tests/validation_old/TensorVisitors.h (renamed from tests/validation/TensorVisitors.h) | 2 | ||||
-rw-r--r-- | tests/validation_old/UNIT/FixedPoint.cpp (renamed from tests/validation/UNIT/FixedPoint.cpp) | 8 | ||||
-rw-r--r-- | tests/validation_old/UNIT/TensorInfo.cpp (renamed from tests/validation/UNIT/TensorInfo.cpp) | 4 | ||||
-rw-r--r-- | tests/validation_old/UNIT/TensorShape.cpp (renamed from tests/validation/UNIT/TensorShape.cpp) | 4 | ||||
-rw-r--r-- | tests/validation_old/UNIT/Utils.cpp (renamed from tests/validation/UNIT/Utils.cpp) | 4 | ||||
-rw-r--r-- | tests/validation_old/UserConfiguration.cpp (renamed from tests/UserConfiguration.cpp) | 0 | ||||
-rw-r--r-- | tests/validation_old/UserConfiguration.h (renamed from tests/UserConfiguration.h) | 0 | ||||
-rw-r--r-- | tests/validation_old/Validation.cpp | 477 | ||||
-rw-r--r-- | tests/validation_old/Validation.h | 193 | ||||
-rw-r--r-- | tests/validation_old/ValidationProgramOptions.cpp (renamed from tests/validation/ValidationProgramOptions.cpp) | 0 | ||||
-rw-r--r-- | tests/validation_old/ValidationProgramOptions.h (renamed from tests/validation/ValidationProgramOptions.h) | 0 | ||||
-rw-r--r-- | tests/validation_old/ValidationUserConfiguration.h (renamed from tests/validation/ValidationUserConfiguration.h) | 0 | ||||
-rw-r--r-- | tests/validation_old/boost_wrapper.h (renamed from tests/boost_wrapper.h) | 0 | ||||
-rw-r--r-- | tests/validation_old/dataset/ActivationFunctionDataset.h (renamed from tests/dataset/ActivationFunctionDataset.h) | 4 | ||||
-rw-r--r-- | tests/validation_old/dataset/ActivationLayerDataset.h (renamed from tests/dataset/ActivationLayerDataset.h) | 4 | ||||
-rw-r--r-- | tests/validation_old/dataset/BatchNormalizationLayerDataset.h (renamed from tests/dataset/BatchNormalizationLayerDataset.h) | 4 | ||||
-rw-r--r-- | tests/validation_old/dataset/BorderModeDataset.h (renamed from tests/dataset/BorderModeDataset.h) | 2 | ||||
-rw-r--r-- | tests/validation_old/dataset/ConvertPolicyDataset.h (renamed from tests/dataset/ConvertPolicyDataset.h) | 2 | ||||
-rw-r--r-- | tests/validation_old/dataset/ConvolutionLayerDataset.h (renamed from tests/dataset/ConvolutionLayerDataset.h) | 6 | ||||
-rw-r--r-- | tests/validation_old/dataset/DataTypeDatasets.h (renamed from tests/dataset/DataTypeDatasets.h) | 2 | ||||
-rw-r--r-- | tests/validation_old/dataset/FullyConnectedLayerDataset.h (renamed from tests/dataset/FullyConnectedLayerDataset.h) | 4 | ||||
-rw-r--r-- | tests/validation_old/dataset/GEMMDataset.h (renamed from tests/dataset/GEMMDataset.h) | 4 | ||||
-rw-r--r-- | tests/validation_old/dataset/GenericDataset.h (renamed from tests/dataset/GenericDataset.h) | 2 | ||||
-rw-r--r-- | tests/validation_old/dataset/ImageDatasets.h (renamed from tests/dataset/ImageDatasets.h) | 2 | ||||
-rw-r--r-- | tests/validation_old/dataset/InterpolationPolicyDataset.h (renamed from tests/dataset/InterpolationPolicyDataset.h) | 2 | ||||
-rw-r--r-- | tests/validation_old/dataset/MatrixPatternDataset.h (renamed from tests/dataset/MatrixPatternDataset.h) | 2 | ||||
-rw-r--r-- | tests/validation_old/dataset/NonLinearFilterFunctionDataset.h (renamed from tests/dataset/NonLinearFilterFunctionDataset.h) | 2 | ||||
-rw-r--r-- | tests/validation_old/dataset/NormalizationLayerDataset.h (renamed from tests/dataset/NormalizationLayerDataset.h) | 4 | ||||
-rw-r--r-- | tests/validation_old/dataset/NormalizationTypeDataset.h (renamed from tests/dataset/NormalizationTypeDataset.h) | 2 | ||||
-rw-r--r-- | tests/validation_old/dataset/PoolingLayerDataset.h (renamed from tests/dataset/PoolingLayerDataset.h) | 4 | ||||
-rw-r--r-- | tests/validation_old/dataset/PoolingTypesDataset.h (renamed from tests/dataset/PoolingTypesDataset.h) | 4 | ||||
-rw-r--r-- | tests/validation_old/dataset/RoundingPolicyDataset.h (renamed from tests/dataset/RoundingPolicyDataset.h) | 2 | ||||
-rw-r--r-- | tests/validation_old/dataset/ShapeDatasets.h (renamed from tests/dataset/ShapeDatasets.h) | 2 | ||||
-rw-r--r-- | tests/validation_old/dataset/ThresholdDataset.h (renamed from tests/dataset/ThresholdDataset.h) | 4 | ||||
-rw-r--r-- | tests/validation_old/half.h (renamed from tests/validation_new/half.h) | 1 | ||||
-rw-r--r-- | tests/validation_old/main.cpp (renamed from tests/validation/main.cpp) | 6 | ||||
-rw-r--r-- | tests/validation_old/model_objects/AlexNet.h (renamed from tests/model_objects/AlexNet.h) | 0 | ||||
-rw-r--r-- | tests/validation_old/model_objects/LeNet5.h (renamed from tests/model_objects/LeNet5.h) | 0 | ||||
-rw-r--r-- | tests/validation_old/system_tests/CL/AlexNet.cpp (renamed from tests/validation/system_tests/CL/AlexNet.cpp) | 4 | ||||
-rw-r--r-- | tests/validation_old/system_tests/CL/LeNet5.cpp (renamed from tests/validation/system_tests/CL/LeNet5.cpp) | 4 | ||||
-rw-r--r-- | tests/validation_old/system_tests/NEON/AlexNet.cpp (renamed from tests/validation/system_tests/NEON/AlexNet.cpp) | 4 | ||||
-rw-r--r-- | tests/validation_old/system_tests/NEON/LeNet5.cpp (renamed from tests/validation/system_tests/NEON/LeNet5.cpp) | 4 |
390 files changed, 10139 insertions, 2860 deletions
diff --git a/tests/AssetsLibrary.cpp b/tests/AssetsLibrary.cpp index be565d9aaf..d7c881d9a8 100644 --- a/tests/AssetsLibrary.cpp +++ b/tests/AssetsLibrary.cpp @@ -21,10 +21,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" +#include "tests/AssetsLibrary.h" #include "TypePrinter.h" -#include "UserConfiguration.h" #include "Utils.h" #include "arm_compute/core/ITensor.h" diff --git a/tests/AssetsLibrary.h b/tests/AssetsLibrary.h index 2993662dc7..6945aa6fe1 100644 --- a/tests/AssetsLibrary.h +++ b/tests/AssetsLibrary.h @@ -34,7 +34,7 @@ #include "tests/RawTensor.h" #include "tests/TensorCache.h" #include "tests/Utils.h" -#include "tests/validation/half.h" +#include "tests/validation_old/half.h" #include <algorithm> #include <cstddef> diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt deleted file mode 100644 index 70dfd67728..0000000000 --- a/tests/CMakeLists.txt +++ /dev/null @@ -1,85 +0,0 @@ -# Copyright (c) 2017 ARM Limited. -# -# SPDX-License-Identifier: MIT -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -cmake_minimum_required (VERSION 3.1) -project (arm_compute_test) - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -add_library(boost_unit_test_framework STATIC IMPORTED) -set_target_properties(boost_unit_test_framework PROPERTIES - IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/../3rdparty/linux/armv7a/libboost_unit_test_framework.a" -) - -add_library(boost_program_options STATIC IMPORTED) -set_target_properties(boost_program_options PROPERTIES - IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/../3rdparty/linux/armv7a/libboost_program_options.a" -) - -add_library(arm_compute SHARED IMPORTED) -set_target_properties(arm_compute PROPERTIES - IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/../build/libarm_compute.so" -) - -include_directories("${CMAKE_SOURCE_DIR}") -include_directories("${CMAKE_SOURCE_DIR}/..") -include_directories("${CMAKE_SOURCE_DIR}/../3rdparty/include/") - -# AssetsLibrary -set(tensor_library_SOURCE_FILES - ${CMAKE_SOURCE_DIR}/RawTensor.h - ${CMAKE_SOURCE_DIR}/RawTensor.cpp - ${CMAKE_SOURCE_DIR}/TensorCache.h - ${CMAKE_SOURCE_DIR}/AssetsLibrary.h - ${CMAKE_SOURCE_DIR}/AssetsLibrary.cpp -) - -add_library(tensor_library OBJECT - ${tensor_library_SOURCE_FILES} -) - -set(arm_compute_test_SOURCE_FILES - ${CMAKE_SOURCE_DIR}/BorderModeDataset.h - ${CMAKE_SOURCE_DIR}/ConvertPolicyDataset.h - ${CMAKE_SOURCE_DIR}/Globals.h - ${CMAKE_SOURCE_DIR}/IAccessor.h - ${CMAKE_SOURCE_DIR}/ImageDatasets.h - ${CMAKE_SOURCE_DIR}/InterpolationPolicyDataset.h - ${CMAKE_SOURCE_DIR}/NormalizationTypeDataset.h - ${CMAKE_SOURCE_DIR}/ProgramOptions.h - ${CMAKE_SOURCE_DIR}/ProgramOptions.cpp - ${CMAKE_SOURCE_DIR}/RoundingPolicyDataset.h - ${CMAKE_SOURCE_DIR}/ShapeDatasets.h - ${CMAKE_SOURCE_DIR}/TypePrinter.h - ${CMAKE_SOURCE_DIR}/TypeReader.h - ${CMAKE_SOURCE_DIR}/UserConfiguration.h - ${CMAKE_SOURCE_DIR}/UserConfiguration.cpp - ${CMAKE_SOURCE_DIR}/Utils.h - ${CMAKE_SOURCE_DIR}/boost_wrapper.h -) - -add_library(arm_compute_test OBJECT - ${arm_compute_test_SOURCE_FILES} -) - -add_subdirectory(validation) -add_subdirectory(benchmark) diff --git a/tests/Globals.h b/tests/Globals.h index d94250bb82..c4c450c5fe 100644 --- a/tests/Globals.h +++ b/tests/Globals.h @@ -24,7 +24,7 @@ #ifndef __ARM_COMPUTE_TEST_GLOBALS_H__ #define __ARM_COMPUTE_TEST_GLOBALS_H__ -#include "AssetsLibrary.h" +#include "tests/AssetsLibrary.h" #include <memory> diff --git a/tests/RawTensor.h b/tests/RawTensor.h index f1a9af37c9..fd0ab2b9fd 100644 --- a/tests/RawTensor.h +++ b/tests/RawTensor.h @@ -24,7 +24,7 @@ #ifndef __ARM_COMPUTE_TEST_RAW_TENSOR_H__ #define __ARM_COMPUTE_TEST_RAW_TENSOR_H__ -#include "SimpleTensor.h" +#include "tests/SimpleTensor.h" namespace arm_compute { diff --git a/tests/SConscript b/tests/SConscript index 92a8b59d29..9be03adeb7 100644 --- a/tests/SConscript +++ b/tests/SConscript @@ -25,6 +25,11 @@ import os.path Import('env') Import('vars') +SConscript('./framework/SConscript', duplicate=0) + +#FIXME: Remove before release +SConscript('./validation_old/SConscript', duplicate=0) + # vars is imported from arm_compute: variables = [ #FIXME Remove before release (And remove all references to INTERNAL_ONLY) @@ -42,75 +47,10 @@ for v in variables: vars.Add(v) # Clone the environment to make sure we're not polluting the arm_compute one: -old_validation_env = env.Clone() -vars.Update(old_validation_env) - -Help(new_options.GenerateHelpText(old_validation_env)) - -if env['os'] in ['android', 'bare_metal'] or env['standalone']: - Import('arm_compute_a') - old_validation_env.Append(LIBS = [arm_compute_a]) - arm_compute_lib = arm_compute_a -else: - Import('arm_compute_so') - old_validation_env.Append(LIBS = ["arm_compute"]) - arm_compute_lib = arm_compute_so - -#FIXME Delete before release -if old_validation_env['internal_only']: - old_validation_env.Append(CPPDEFINES=['INTERNAL_ONLY']) - -old_validation_env.Append(CPPPATH = [".", "#3rdparty/include"]) -old_validation_env.Append(LIBPATH = ["#3rdparty/%s/%s" % (env['os'], env['arch'])]) -old_validation_env.Append(LIBPATH = ["#build/%s" % env['build_dir']]) -old_validation_env.Append(LIBPATH = ["#build/%s/opencl-1.2-stubs" % env['build_dir']]) -old_validation_env.Append(LIBS = ['boost_program_options']) -old_validation_env.Append(CXXFLAGS = ['-Wno-missing-field-initializers']) -old_validation_env.Append(CPPDEFINES=['BOOST']) -old_validation_env.Append(LIBS = ['boost_unit_test_framework']) - -old_files_validation = Glob('*.cpp') -old_files_validation = [f for f in old_files_validation if "main.cpp" not in os.path.basename(str(f))] -old_files_validation += Glob('validation/*.cpp') - -# Add unit tests -old_files_validation += Glob('validation/UNIT/*.cpp') -old_files_validation += Glob('validation/UNIT/*/*.cpp') - -if env['opencl']: - Import('opencl') - - old_files_validation += Glob('validation/CL/*.cpp') - old_files_validation += Glob('validation/CL/*/*.cpp') - old_files_validation += Glob('validation/system_tests/CL/*.cpp') - - old_validation_env.Append(LIBS = "OpenCL") - old_validation_env.Append(CPPDEFINES=['ARM_COMPUTE_CL']) - -if env['neon']: - old_files_validation += Glob('validation/NEON/*.cpp') - old_files_validation += Glob('validation/NEON/*/*.cpp') - old_files_validation += Glob('validation/system_tests/NEON/*.cpp') - -if env['os'] == 'android': - old_validation_env.Append(LIBS = ["log"]) - -if old_validation_env['validation_tests']: - arm_compute_validation = old_validation_env.Program('arm_compute_validation', old_files_validation) - Depends(arm_compute_validation, arm_compute_lib) - if env['opencl']: - Depends(arm_compute_validation, opencl) - Default(arm_compute_validation) - Export('arm_compute_validation') - -####################################################################### -# Using new framework -####################################################################### - -# Clone the environment to make sure we're not polluting the arm_compute one: test_env = env.Clone() -# Workaround to build both test systems in parallel -test_env.VariantDir("new", ".", duplicate=0) +vars.Update(test_env) + +Help(new_options.GenerateHelpText(test_env)) if env['os'] in ['android', 'bare_metal'] or env['standalone']: Import("arm_compute_a") @@ -122,29 +62,25 @@ else: arm_compute_lib = arm_compute_so #FIXME Delete before release -if old_validation_env['internal_only']: +if test_env['internal_only']: test_env.Append(CPPDEFINES=['INTERNAL_ONLY']) -test_env.Append(CPPPATH = [".", "#3rdparty/include"]) +test_env.Append(CPPPATH = ["#3rdparty/include"]) test_env.Append(LIBPATH = ["#3rdparty/%s/%s" % (env['os'], env['arch'])]) test_env.Append(LIBPATH = ["#build/%s" % env['build_dir']]) -test_env.Append(LIBPATH = ["#build/%s/framework" % env['build_dir']]) test_env.Append(LIBPATH = ["#build/%s/opencl-1.2-stubs" % env['build_dir']]) Import("arm_compute_test_framework") test_env.Append(LIBS = arm_compute_test_framework) -common_files = Glob('new/AssetsLibrary.cpp') -common_files += Glob('new/RawTensor.cpp') -common_files += Glob('new/main.cpp') - +common_files = Glob('*.cpp') common_objects = [test_env.StaticObject(f) for f in common_files] -files_benchmark = Glob('new/benchmark_new/*.cpp') -files_validation = Glob('new/validation_new/*.cpp') +files_benchmark = Glob('benchmark/*.cpp') +files_validation = Glob('validation/*.cpp') # Always compile reference for validation -files_validation += Glob('new/validation_new/CPP/*.cpp') +files_validation += Glob('validation/CPP/*.cpp') if env['opencl']: Import('opencl') @@ -152,25 +88,25 @@ if env['opencl']: test_env.Append(CPPDEFINES=['ARM_COMPUTE_CL']) test_env.Append(LIBS = ["OpenCL"]) - files_benchmark += Glob('new/benchmark_new/CL/*/*.cpp') - files_benchmark += Glob('new/benchmark_new/CL/*.cpp') + files_benchmark += Glob('benchmark/CL/*/*.cpp') + files_benchmark += Glob('benchmark/CL/*.cpp') - files_validation += Glob('new/validation_new/CL/*/*.cpp') - files_validation += Glob('new/validation_new/CL/*.cpp') + files_validation += Glob('validation/CL/*/*.cpp') + files_validation += Glob('validation/CL/*.cpp') if env['neon']: - files_benchmark += Glob('new/benchmark_new/NEON/*/*.cpp') - files_benchmark += Glob('new/benchmark_new/NEON/*.cpp') + files_benchmark += Glob('benchmark/NEON/*/*.cpp') + files_benchmark += Glob('benchmark/NEON/*.cpp') - files_validation += Glob('new/validation_new/NEON/*/*.cpp') - files_validation += Glob('new/validation_new/NEON/*.cpp') + files_validation += Glob('validation/NEON/*/*.cpp') + files_validation += Glob('validation/NEON/*.cpp') if env['os'] == 'android': test_env.Append(LIBS = ["log"]) else: test_env.Append(LIBS = ["rt"]) -if old_validation_env['benchmark_tests']: +if test_env['benchmark_tests']: arm_compute_benchmark = test_env.Program('arm_compute_benchmark', files_benchmark + common_objects) Depends(arm_compute_benchmark, arm_compute_test_framework) Depends(arm_compute_benchmark, arm_compute_lib) @@ -181,13 +117,13 @@ if old_validation_env['benchmark_tests']: Default(arm_compute_benchmark) Export('arm_compute_benchmark') -if old_validation_env['validation_tests']: - arm_compute_validation_new = test_env.Program('arm_compute_validation_new', files_validation + common_objects) - Depends(arm_compute_validation_new, arm_compute_test_framework) - Depends(arm_compute_validation_new, arm_compute_lib) +if test_env['validation_tests']: + arm_compute_validation = test_env.Program('arm_compute_validation', files_validation + common_objects) + Depends(arm_compute_validation, arm_compute_test_framework) + Depends(arm_compute_validation, arm_compute_lib) if env['opencl']: - Depends(arm_compute_validation_new, opencl) + Depends(arm_compute_validation, opencl) - Default(arm_compute_validation_new) - Export('arm_compute_validation_new') + Default(arm_compute_validation) + Export('arm_compute_validation') diff --git a/tests/Utils.h b/tests/Utils.h index f1725d7d74..7af38e5c93 100644 --- a/tests/Utils.h +++ b/tests/Utils.h @@ -31,7 +31,7 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" #include "support/ToolchainSupport.h" -#include "tests/validation_new/half.h" +#include "tests/validation/half.h" #include <cmath> #include <cstddef> diff --git a/tests/benchmark_new/CL/ActivationLayer.cpp b/tests/benchmark/CL/ActivationLayer.cpp index 4edbc55065..50a2004b07 100644 --- a/tests/benchmark_new/CL/ActivationLayer.cpp +++ b/tests/benchmark/CL/ActivationLayer.cpp @@ -26,18 +26,18 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLActivationLayer.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/system_tests/alexnet/AlexNetActivationLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ActivationLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ActivationLayerDataset.h" -#include "tests/datasets_new/system_tests/lenet5/LeNet5ActivationLayerDataset.h" -#include "tests/datasets_new/system_tests/squeezenet/SqueezeNetActivationLayerDataset.h" -#include "tests/datasets_new/system_tests/vgg/vgg16/VGG16ActivationLayerDataset.h" -#include "tests/datasets_new/system_tests/yolo/v2/YOLOV2ActivationLayerDataset.h" -#include "tests/fixtures_new/ActivationLayerFixture.h" +#include "tests/benchmark/fixtures/ActivationLayerFixture.h" +#include "tests/datasets/system_tests/alexnet/AlexNetActivationLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ActivationLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ActivationLayerDataset.h" +#include "tests/datasets/system_tests/lenet5/LeNet5ActivationLayerDataset.h" +#include "tests/datasets/system_tests/squeezenet/SqueezeNetActivationLayerDataset.h" +#include "tests/datasets/system_tests/vgg/vgg16/VGG16ActivationLayerDataset.h" +#include "tests/datasets/system_tests/yolo/v2/YOLOV2ActivationLayerDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/CL/BatchNormalizationLayer.cpp b/tests/benchmark/CL/BatchNormalizationLayer.cpp index fb081341c9..b0e36d31af 100644 --- a/tests/benchmark_new/CL/BatchNormalizationLayer.cpp +++ b/tests/benchmark/CL/BatchNormalizationLayer.cpp @@ -26,13 +26,13 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLBatchNormalizationLayer.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4BatchNormalizationLayerDataset.h" -#include "tests/datasets_new/system_tests/yolo/v2/YOLOV2BatchNormalizationLayerDataset.h" -#include "tests/fixtures_new/BatchNormalizationLayerFixture.h" +#include "tests/benchmark/fixtures/BatchNormalizationLayerFixture.h" +#include "tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4BatchNormalizationLayerDataset.h" +#include "tests/datasets/system_tests/yolo/v2/YOLOV2BatchNormalizationLayerDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/CL/ConvolutionLayer.cpp b/tests/benchmark/CL/ConvolutionLayer.cpp index 6447004f06..122e19bbe5 100644 --- a/tests/benchmark_new/CL/ConvolutionLayer.cpp +++ b/tests/benchmark/CL/ConvolutionLayer.cpp @@ -26,18 +26,18 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLConvolutionLayer.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/system_tests/alexnet/AlexNetConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/lenet5/LeNet5ConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h" -#include "tests/fixtures_new/ConvolutionLayerFixture.h" +#include "tests/benchmark/fixtures/ConvolutionLayerFixture.h" +#include "tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/lenet5/LeNet5ConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/CL/DepthwiseConvolution.cpp b/tests/benchmark/CL/DepthwiseConvolution.cpp index 15c474fd12..acdc4019b4 100644 --- a/tests/benchmark_new/CL/DepthwiseConvolution.cpp +++ b/tests/benchmark/CL/DepthwiseConvolution.cpp @@ -26,12 +26,12 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLDepthwiseConvolution.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/MobileNetDepthwiseConvolutionDataset.h" -#include "tests/fixtures_new/DepthwiseConvolutionFixture.h" +#include "tests/benchmark/fixtures/DepthwiseConvolutionFixture.h" +#include "tests/datasets/MobileNetDepthwiseConvolutionDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/CL/DepthwiseSeparableConvolutionLayer.cpp b/tests/benchmark/CL/DepthwiseSeparableConvolutionLayer.cpp index 038a2ab72d..1ab8628435 100644 --- a/tests/benchmark_new/CL/DepthwiseSeparableConvolutionLayer.cpp +++ b/tests/benchmark/CL/DepthwiseSeparableConvolutionLayer.cpp @@ -26,12 +26,12 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLDepthwiseSeparableConvolutionLayer.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/MobileNetDepthwiseSeparableConvolutionLayerDataset.h" -#include "tests/fixtures_new/DepthwiseSeparableConvolutionLayerFixture.h" +#include "tests/benchmark/fixtures/DepthwiseSeparableConvolutionLayerFixture.h" +#include "tests/datasets/MobileNetDepthwiseSeparableConvolutionLayerDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/CL/DirectConvolutionLayer.cpp b/tests/benchmark/CL/DirectConvolutionLayer.cpp index 675739bac9..15bf8084ea 100644 --- a/tests/benchmark_new/CL/DirectConvolutionLayer.cpp +++ b/tests/benchmark/CL/DirectConvolutionLayer.cpp @@ -26,17 +26,17 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLDirectConvolutionLayer.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/system_tests/alexnet/AlexNetConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h" -#include "tests/fixtures_new/ConvolutionLayerFixture.h" +#include "tests/benchmark/fixtures/ConvolutionLayerFixture.h" +#include "tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/CL/Floor.cpp b/tests/benchmark/CL/Floor.cpp index cfa9d173f0..ce8fa487c1 100644 --- a/tests/benchmark_new/CL/Floor.cpp +++ b/tests/benchmark/CL/Floor.cpp @@ -26,12 +26,12 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLFloor.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/fixtures_new/FloorFixture.h" +#include "tests/benchmark/fixtures/FloorFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/CL/FullyConnectedLayer.cpp b/tests/benchmark/CL/FullyConnectedLayer.cpp index e8f11b6c37..d41424acce 100644 --- a/tests/benchmark_new/CL/FullyConnectedLayer.cpp +++ b/tests/benchmark/CL/FullyConnectedLayer.cpp @@ -26,16 +26,16 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/system_tests/alexnet/AlexNetFullyConnectedLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1FullyConnectedLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4FullyConnectedLayerDataset.h" -#include "tests/datasets_new/system_tests/lenet5/LeNet5FullyConnectedLayerDataset.h" -#include "tests/datasets_new/system_tests/vgg/vgg16/VGG16FullyConnectedLayerDataset.h" -#include "tests/fixtures_new/FullyConnectedLayerFixture.h" +#include "tests/benchmark/fixtures/FullyConnectedLayerFixture.h" +#include "tests/datasets/system_tests/alexnet/AlexNetFullyConnectedLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1FullyConnectedLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4FullyConnectedLayerDataset.h" +#include "tests/datasets/system_tests/lenet5/LeNet5FullyConnectedLayerDataset.h" +#include "tests/datasets/system_tests/vgg/vgg16/VGG16FullyConnectedLayerDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/CL/GEMM.cpp b/tests/benchmark/CL/GEMM.cpp index 9b35285e7c..3febef5613 100644 --- a/tests/benchmark_new/CL/GEMM.cpp +++ b/tests/benchmark/CL/GEMM.cpp @@ -25,13 +25,13 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLGEMM.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/MatrixMultiplyGEMMDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1GEMMDataset.h" -#include "tests/fixtures_new/GEMMFixture.h" +#include "tests/benchmark/fixtures/GEMMFixture.h" +#include "tests/datasets/MatrixMultiplyGEMMDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1GEMMDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/CL/NormalizationLayer.cpp b/tests/benchmark/CL/NormalizationLayer.cpp index f433172cd1..2035ae301a 100644 --- a/tests/benchmark_new/CL/NormalizationLayer.cpp +++ b/tests/benchmark/CL/NormalizationLayer.cpp @@ -26,13 +26,13 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLNormalizationLayer.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/system_tests/alexnet/AlexNetNormalizationLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1NormalizationLayerDataset.h" -#include "tests/fixtures_new/NormalizationLayerFixture.h" +#include "tests/benchmark/fixtures/NormalizationLayerFixture.h" +#include "tests/datasets/system_tests/alexnet/AlexNetNormalizationLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1NormalizationLayerDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/CL/PoolingLayer.cpp b/tests/benchmark/CL/PoolingLayer.cpp index 15c98cbe30..fcc37e9571 100644 --- a/tests/benchmark_new/CL/PoolingLayer.cpp +++ b/tests/benchmark/CL/PoolingLayer.cpp @@ -26,18 +26,18 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLPoolingLayer.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/system_tests/alexnet/AlexNetPoolingLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1PoolingLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h" -#include "tests/datasets_new/system_tests/lenet5/LeNet5PoolingLayerDataset.h" -#include "tests/datasets_new/system_tests/squeezenet/SqueezeNetPoolingLayerDataset.h" -#include "tests/datasets_new/system_tests/vgg/vgg16/VGG16PoolingLayerDataset.h" -#include "tests/datasets_new/system_tests/yolo/v2/YOLOV2PoolingLayerDataset.h" -#include "tests/fixtures_new/PoolingLayerFixture.h" +#include "tests/benchmark/fixtures/PoolingLayerFixture.h" +#include "tests/datasets/system_tests/alexnet/AlexNetPoolingLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1PoolingLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h" +#include "tests/datasets/system_tests/lenet5/LeNet5PoolingLayerDataset.h" +#include "tests/datasets/system_tests/squeezenet/SqueezeNetPoolingLayerDataset.h" +#include "tests/datasets/system_tests/vgg/vgg16/VGG16PoolingLayerDataset.h" +#include "tests/datasets/system_tests/yolo/v2/YOLOV2PoolingLayerDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/CL/ROIPoolingLayer.cpp b/tests/benchmark/CL/ROIPoolingLayer.cpp index 260f4d7b0d..a10134fb04 100644 --- a/tests/benchmark_new/CL/ROIPoolingLayer.cpp +++ b/tests/benchmark/CL/ROIPoolingLayer.cpp @@ -27,13 +27,13 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLROIPoolingLayer.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/CL/CLArrayAccessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/ROIPoolingLayerDataset.h" -#include "tests/fixtures_new/ROIPoolingLayerFixture.h" +#include "tests/benchmark/fixtures/ROIPoolingLayerFixture.h" +#include "tests/datasets/ROIPoolingLayerDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/CL/SYSTEM/AlexNet.cpp b/tests/benchmark/CL/SYSTEM/AlexNet.cpp index 4e5e729501..fcf8a52f9e 100644 --- a/tests/benchmark_new/CL/SYSTEM/AlexNet.cpp +++ b/tests/benchmark/CL/SYSTEM/AlexNet.cpp @@ -33,11 +33,11 @@ #include "arm_compute/runtime/CL/functions/CLNormalizationLayer.h" #include "arm_compute/runtime/CL/functions/CLPoolingLayer.h" #include "arm_compute/runtime/CL/functions/CLSoftmaxLayer.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/TypePrinter.h" -#include "tests/fixtures_new/AlexNetFixture.h" +#include "tests/benchmark/fixtures/AlexNetFixture.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/CL/SYSTEM/LeNet5.cpp b/tests/benchmark/CL/SYSTEM/LeNet5.cpp index 1b500bfabb..35ebc7d8fb 100644 --- a/tests/benchmark_new/CL/SYSTEM/LeNet5.cpp +++ b/tests/benchmark/CL/SYSTEM/LeNet5.cpp @@ -30,11 +30,11 @@ #include "arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h" #include "arm_compute/runtime/CL/functions/CLPoolingLayer.h" #include "arm_compute/runtime/CL/functions/CLSoftmaxLayer.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/TypePrinter.h" -#include "tests/fixtures_new/LeNet5Fixture.h" +#include "tests/benchmark/fixtures/LeNet5Fixture.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/NEON/ActivationLayer.cpp b/tests/benchmark/NEON/ActivationLayer.cpp index 9083ce9091..0b699f2501 100644 --- a/tests/benchmark_new/NEON/ActivationLayer.cpp +++ b/tests/benchmark/NEON/ActivationLayer.cpp @@ -26,18 +26,18 @@ #include "arm_compute/runtime/NEON/functions/NEActivationLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/system_tests/alexnet/AlexNetActivationLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ActivationLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ActivationLayerDataset.h" -#include "tests/datasets_new/system_tests/lenet5/LeNet5ActivationLayerDataset.h" -#include "tests/datasets_new/system_tests/squeezenet/SqueezeNetActivationLayerDataset.h" -#include "tests/datasets_new/system_tests/vgg/vgg16/VGG16ActivationLayerDataset.h" -#include "tests/datasets_new/system_tests/yolo/v2/YOLOV2ActivationLayerDataset.h" -#include "tests/fixtures_new/ActivationLayerFixture.h" +#include "tests/benchmark/fixtures/ActivationLayerFixture.h" +#include "tests/datasets/system_tests/alexnet/AlexNetActivationLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ActivationLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ActivationLayerDataset.h" +#include "tests/datasets/system_tests/lenet5/LeNet5ActivationLayerDataset.h" +#include "tests/datasets/system_tests/squeezenet/SqueezeNetActivationLayerDataset.h" +#include "tests/datasets/system_tests/vgg/vgg16/VGG16ActivationLayerDataset.h" +#include "tests/datasets/system_tests/yolo/v2/YOLOV2ActivationLayerDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/NEON/BatchNormalizationLayer.cpp b/tests/benchmark/NEON/BatchNormalizationLayer.cpp index ffc7d4b19e..1b0d484404 100644 --- a/tests/benchmark_new/NEON/BatchNormalizationLayer.cpp +++ b/tests/benchmark/NEON/BatchNormalizationLayer.cpp @@ -26,14 +26,14 @@ #include "arm_compute/runtime/NEON/functions/NEBatchNormalizationLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/TypePrinter.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4BatchNormalizationLayerDataset.h" -#include "tests/datasets_new/system_tests/yolo/v2/YOLOV2BatchNormalizationLayerDataset.h" -#include "tests/fixtures_new/BatchNormalizationLayerFixture.h" +#include "tests/benchmark/fixtures/BatchNormalizationLayerFixture.h" +#include "tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4BatchNormalizationLayerDataset.h" +#include "tests/datasets/system_tests/yolo/v2/YOLOV2BatchNormalizationLayerDataset.h" namespace arm_compute { diff --git a/tests/benchmark_new/NEON/ConvolutionLayer.cpp b/tests/benchmark/NEON/ConvolutionLayer.cpp index 548fe8b8c5..ba682825f1 100644 --- a/tests/benchmark_new/NEON/ConvolutionLayer.cpp +++ b/tests/benchmark/NEON/ConvolutionLayer.cpp @@ -26,18 +26,18 @@ #include "arm_compute/runtime/NEON/functions/NEConvolutionLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/system_tests/alexnet/AlexNetConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/lenet5/LeNet5ConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h" -#include "tests/fixtures_new/ConvolutionLayerFixture.h" +#include "tests/benchmark/fixtures/ConvolutionLayerFixture.h" +#include "tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/lenet5/LeNet5ConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/NEON/DirectConvolutionLayer.cpp b/tests/benchmark/NEON/DirectConvolutionLayer.cpp index 1233b0cd1d..a9dd4b94ea 100644 --- a/tests/benchmark_new/NEON/DirectConvolutionLayer.cpp +++ b/tests/benchmark/NEON/DirectConvolutionLayer.cpp @@ -26,18 +26,18 @@ #include "arm_compute/runtime/NEON/functions/NEDirectConvolutionLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/DirectConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/alexnet/AlexNetConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h" -#include "tests/datasets_new/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h" -#include "tests/fixtures_new/ConvolutionLayerFixture.h" +#include "tests/benchmark/fixtures/ConvolutionLayerFixture.h" +#include "tests/datasets/DirectConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h" +#include "tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/NEON/Floor.cpp b/tests/benchmark/NEON/Floor.cpp index ea6a52b4b2..4bc0c05fdc 100644 --- a/tests/benchmark_new/NEON/Floor.cpp +++ b/tests/benchmark/NEON/Floor.cpp @@ -26,12 +26,12 @@ #include "arm_compute/runtime/NEON/functions/NEFloor.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/fixtures_new/FloorFixture.h" +#include "tests/benchmark/fixtures/FloorFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/NEON/FullyConnectedLayer.cpp b/tests/benchmark/NEON/FullyConnectedLayer.cpp index 72a0742c46..88499b1b6f 100644 --- a/tests/benchmark_new/NEON/FullyConnectedLayer.cpp +++ b/tests/benchmark/NEON/FullyConnectedLayer.cpp @@ -26,16 +26,16 @@ #include "arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/system_tests/alexnet/AlexNetFullyConnectedLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1FullyConnectedLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4FullyConnectedLayerDataset.h" -#include "tests/datasets_new/system_tests/lenet5/LeNet5FullyConnectedLayerDataset.h" -#include "tests/datasets_new/system_tests/vgg/vgg16/VGG16FullyConnectedLayerDataset.h" -#include "tests/fixtures_new/FullyConnectedLayerFixture.h" +#include "tests/benchmark/fixtures/FullyConnectedLayerFixture.h" +#include "tests/datasets/system_tests/alexnet/AlexNetFullyConnectedLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1FullyConnectedLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4FullyConnectedLayerDataset.h" +#include "tests/datasets/system_tests/lenet5/LeNet5FullyConnectedLayerDataset.h" +#include "tests/datasets/system_tests/vgg/vgg16/VGG16FullyConnectedLayerDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/NEON/GEMM.cpp b/tests/benchmark/NEON/GEMM.cpp index 59ac4329c0..2c5a726784 100644 --- a/tests/benchmark_new/NEON/GEMM.cpp +++ b/tests/benchmark/NEON/GEMM.cpp @@ -26,13 +26,13 @@ #include "arm_compute/runtime/NEON/functions/NEGEMM.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/MatrixMultiplyGEMMDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1GEMMDataset.h" -#include "tests/fixtures_new/GEMMFixture.h" +#include "tests/benchmark/fixtures/GEMMFixture.h" +#include "tests/datasets/MatrixMultiplyGEMMDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1GEMMDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/NEON/NormalizationLayer.cpp b/tests/benchmark/NEON/NormalizationLayer.cpp index fefcb96b21..04887951bd 100644 --- a/tests/benchmark_new/NEON/NormalizationLayer.cpp +++ b/tests/benchmark/NEON/NormalizationLayer.cpp @@ -26,13 +26,13 @@ #include "arm_compute/runtime/NEON/functions/NENormalizationLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/system_tests/alexnet/AlexNetNormalizationLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1NormalizationLayerDataset.h" -#include "tests/fixtures_new/NormalizationLayerFixture.h" +#include "tests/benchmark/fixtures/NormalizationLayerFixture.h" +#include "tests/datasets/system_tests/alexnet/AlexNetNormalizationLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1NormalizationLayerDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/NEON/PoolingLayer.cpp b/tests/benchmark/NEON/PoolingLayer.cpp index 59cb127a45..05a173b283 100644 --- a/tests/benchmark_new/NEON/PoolingLayer.cpp +++ b/tests/benchmark/NEON/PoolingLayer.cpp @@ -26,18 +26,18 @@ #include "arm_compute/runtime/NEON/functions/NEPoolingLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/system_tests/alexnet/AlexNetPoolingLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1PoolingLayerDataset.h" -#include "tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h" -#include "tests/datasets_new/system_tests/lenet5/LeNet5PoolingLayerDataset.h" -#include "tests/datasets_new/system_tests/squeezenet/SqueezeNetPoolingLayerDataset.h" -#include "tests/datasets_new/system_tests/vgg/vgg16/VGG16PoolingLayerDataset.h" -#include "tests/datasets_new/system_tests/yolo/v2/YOLOV2PoolingLayerDataset.h" -#include "tests/fixtures_new/PoolingLayerFixture.h" +#include "tests/benchmark/fixtures/PoolingLayerFixture.h" +#include "tests/datasets/system_tests/alexnet/AlexNetPoolingLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1PoolingLayerDataset.h" +#include "tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h" +#include "tests/datasets/system_tests/lenet5/LeNet5PoolingLayerDataset.h" +#include "tests/datasets/system_tests/squeezenet/SqueezeNetPoolingLayerDataset.h" +#include "tests/datasets/system_tests/vgg/vgg16/VGG16PoolingLayerDataset.h" +#include "tests/datasets/system_tests/yolo/v2/YOLOV2PoolingLayerDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/NEON/ROIPoolingLayer.cpp b/tests/benchmark/NEON/ROIPoolingLayer.cpp index e8c5ba3109..d3a7e4b3af 100644 --- a/tests/benchmark_new/NEON/ROIPoolingLayer.cpp +++ b/tests/benchmark/NEON/ROIPoolingLayer.cpp @@ -27,13 +27,13 @@ #include "arm_compute/runtime/NEON/functions/NEROIPoolingLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/NEON/ArrayAccessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/ROIPoolingLayerDataset.h" -#include "tests/fixtures_new/ROIPoolingLayerFixture.h" +#include "tests/benchmark/fixtures/ROIPoolingLayerFixture.h" +#include "tests/datasets/ROIPoolingLayerDataset.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/NEON/SYSTEM/AlexNet.cpp b/tests/benchmark/NEON/SYSTEM/AlexNet.cpp index 5a0cb3cb5b..cd48e5db25 100644 --- a/tests/benchmark_new/NEON/SYSTEM/AlexNet.cpp +++ b/tests/benchmark/NEON/SYSTEM/AlexNet.cpp @@ -33,11 +33,11 @@ #include "arm_compute/runtime/SubTensor.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/TypePrinter.h" -#include "tests/fixtures_new/AlexNetFixture.h" +#include "tests/benchmark/fixtures/AlexNetFixture.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/benchmark_new/NEON/SYSTEM/LeNet5.cpp b/tests/benchmark/NEON/SYSTEM/LeNet5.cpp index 2375c52a1c..46ccfc01d5 100644 --- a/tests/benchmark_new/NEON/SYSTEM/LeNet5.cpp +++ b/tests/benchmark/NEON/SYSTEM/LeNet5.cpp @@ -30,11 +30,11 @@ #include "arm_compute/runtime/NEON/functions/NESoftmaxLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/TypePrinter.h" -#include "tests/fixtures_new/LeNet5Fixture.h" +#include "tests/benchmark/fixtures/LeNet5Fixture.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" namespace arm_compute { diff --git a/tests/fixtures_new/ActivationLayerFixture.h b/tests/benchmark/fixtures/ActivationLayerFixture.h index 5066810c79..9ded063a37 100644 --- a/tests/fixtures_new/ActivationLayerFixture.h +++ b/tests/benchmark/fixtures/ActivationLayerFixture.h @@ -26,9 +26,9 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Fixture.h" #include "tests/Globals.h" #include "tests/Utils.h" +#include "tests/framework/Fixture.h" namespace arm_compute { diff --git a/tests/fixtures_new/AlexNetFixture.h b/tests/benchmark/fixtures/AlexNetFixture.h index 0fbc1b77e3..961f4e889f 100644 --- a/tests/fixtures_new/AlexNetFixture.h +++ b/tests/benchmark/fixtures/AlexNetFixture.h @@ -24,10 +24,10 @@ #ifndef ARM_COMPUTE_TEST_ALEXNETFIXTURE #define ARM_COMPUTE_TEST_ALEXNETFIXTURE -#include "framework/Fixture.h" -#include "networks_new/AlexNetNetwork.h" #include "tests/AssetsLibrary.h" #include "tests/Utils.h" +#include "tests/framework/Fixture.h" +#include "tests/networks/AlexNetNetwork.h" namespace arm_compute { diff --git a/tests/fixtures_new/BatchNormalizationLayerFixture.h b/tests/benchmark/fixtures/BatchNormalizationLayerFixture.h index 39c80e5405..79dbc76300 100644 --- a/tests/fixtures_new/BatchNormalizationLayerFixture.h +++ b/tests/benchmark/fixtures/BatchNormalizationLayerFixture.h @@ -26,9 +26,9 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Fixture.h" #include "tests/Globals.h" #include "tests/Utils.h" +#include "tests/framework/Fixture.h" namespace arm_compute { diff --git a/tests/fixtures_new/ConvolutionLayerFixture.h b/tests/benchmark/fixtures/ConvolutionLayerFixture.h index f41cd1d25e..fd508d4500 100644 --- a/tests/fixtures_new/ConvolutionLayerFixture.h +++ b/tests/benchmark/fixtures/ConvolutionLayerFixture.h @@ -26,9 +26,9 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Fixture.h" #include "tests/Globals.h" #include "tests/Utils.h" +#include "tests/framework/Fixture.h" namespace arm_compute { diff --git a/tests/fixtures_new/DepthwiseConvolutionFixture.h b/tests/benchmark/fixtures/DepthwiseConvolutionFixture.h index 8223c210d4..e080fe253b 100644 --- a/tests/fixtures_new/DepthwiseConvolutionFixture.h +++ b/tests/benchmark/fixtures/DepthwiseConvolutionFixture.h @@ -26,9 +26,9 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Fixture.h" #include "tests/Globals.h" #include "tests/Utils.h" +#include "tests/framework/Fixture.h" namespace arm_compute { diff --git a/tests/fixtures_new/DepthwiseSeparableConvolutionLayerFixture.h b/tests/benchmark/fixtures/DepthwiseSeparableConvolutionLayerFixture.h index c4ace2ba1c..928b0c7328 100644 --- a/tests/fixtures_new/DepthwiseSeparableConvolutionLayerFixture.h +++ b/tests/benchmark/fixtures/DepthwiseSeparableConvolutionLayerFixture.h @@ -26,9 +26,9 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Fixture.h" #include "tests/Globals.h" #include "tests/Utils.h" +#include "tests/framework/Fixture.h" namespace arm_compute { diff --git a/tests/fixtures_new/FloorFixture.h b/tests/benchmark/fixtures/FloorFixture.h index 145b623bdb..8de87b886b 100644 --- a/tests/fixtures_new/FloorFixture.h +++ b/tests/benchmark/fixtures/FloorFixture.h @@ -26,9 +26,9 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Fixture.h" #include "tests/Globals.h" #include "tests/Utils.h" +#include "tests/framework/Fixture.h" namespace arm_compute { diff --git a/tests/fixtures_new/FullyConnectedLayerFixture.h b/tests/benchmark/fixtures/FullyConnectedLayerFixture.h index 82ecb39b9c..2d1f2334b6 100644 --- a/tests/fixtures_new/FullyConnectedLayerFixture.h +++ b/tests/benchmark/fixtures/FullyConnectedLayerFixture.h @@ -26,9 +26,9 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Fixture.h" #include "tests/Globals.h" #include "tests/Utils.h" +#include "tests/framework/Fixture.h" namespace arm_compute { diff --git a/tests/fixtures_new/GEMMFixture.h b/tests/benchmark/fixtures/GEMMFixture.h index 669a91f0cb..0c41c67af1 100644 --- a/tests/fixtures_new/GEMMFixture.h +++ b/tests/benchmark/fixtures/GEMMFixture.h @@ -26,9 +26,9 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Fixture.h" #include "tests/Globals.h" #include "tests/Utils.h" +#include "tests/framework/Fixture.h" namespace arm_compute { diff --git a/tests/fixtures_new/LeNet5Fixture.h b/tests/benchmark/fixtures/LeNet5Fixture.h index 9a2590b39b..77a09d3025 100644 --- a/tests/fixtures_new/LeNet5Fixture.h +++ b/tests/benchmark/fixtures/LeNet5Fixture.h @@ -24,10 +24,10 @@ #ifndef ARM_COMPUTE_TEST_LENET5FIXTURE #define ARM_COMPUTE_TEST_LENET5FIXTURE -#include "framework/Fixture.h" -#include "networks_new/LeNet5Network.h" #include "tests/AssetsLibrary.h" #include "tests/Utils.h" +#include "tests/framework/Fixture.h" +#include "tests/networks/LeNet5Network.h" namespace arm_compute { diff --git a/tests/fixtures_new/NormalizationLayerFixture.h b/tests/benchmark/fixtures/NormalizationLayerFixture.h index 999eed6cff..41dd8a7b27 100644 --- a/tests/fixtures_new/NormalizationLayerFixture.h +++ b/tests/benchmark/fixtures/NormalizationLayerFixture.h @@ -26,9 +26,9 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Fixture.h" #include "tests/Globals.h" #include "tests/Utils.h" +#include "tests/framework/Fixture.h" namespace arm_compute { diff --git a/tests/fixtures_new/PoolingLayerFixture.h b/tests/benchmark/fixtures/PoolingLayerFixture.h index fc9c90ae3c..2060301531 100644 --- a/tests/fixtures_new/PoolingLayerFixture.h +++ b/tests/benchmark/fixtures/PoolingLayerFixture.h @@ -26,9 +26,9 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Fixture.h" #include "tests/Globals.h" #include "tests/Utils.h" +#include "tests/framework/Fixture.h" namespace arm_compute { diff --git a/tests/fixtures_new/ROIPoolingLayerFixture.h b/tests/benchmark/fixtures/ROIPoolingLayerFixture.h index 54dac51ee4..76c2280b74 100644 --- a/tests/fixtures_new/ROIPoolingLayerFixture.h +++ b/tests/benchmark/fixtures/ROIPoolingLayerFixture.h @@ -26,9 +26,9 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Fixture.h" #include "tests/Globals.h" #include "tests/Utils.h" +#include "tests/framework/Fixture.h" #include <vector> diff --git a/tests/datasets_new/ActivationFunctionsDataset.h b/tests/datasets/ActivationFunctionsDataset.h index 0a11902d51..3e4f408614 100644 --- a/tests/datasets_new/ActivationFunctionsDataset.h +++ b/tests/datasets/ActivationFunctionsDataset.h @@ -25,6 +25,9 @@ #define __ARM_COMPUTE_TEST_ACTIVATIONFUNCTIONS_DATASET_H__ #include "arm_compute/core/Types.h" +#include "tests/framework/datasets/ContainerDataset.h" + +#include <vector> namespace arm_compute { diff --git a/tests/datasets_new/BatchNormalizationLayerDataset.h b/tests/datasets/BatchNormalizationLayerDataset.h index 25e65d931c..25e65d931c 100644 --- a/tests/datasets_new/BatchNormalizationLayerDataset.h +++ b/tests/datasets/BatchNormalizationLayerDataset.h diff --git a/tests/datasets_new/BorderModeDataset.h b/tests/datasets/BorderModeDataset.h index b45e7835c1..df024a7dbf 100644 --- a/tests/datasets_new/BorderModeDataset.h +++ b/tests/datasets/BorderModeDataset.h @@ -25,6 +25,9 @@ #define __ARM_COMPUTE_TEST_BORDER_MODE_DATASET_H__ #include "arm_compute/core/Types.h" +#include "tests/framework/datasets/ContainerDataset.h" + +#include <vector> namespace arm_compute { diff --git a/tests/datasets_new/ConvolutionLayerDataset.h b/tests/datasets/ConvolutionLayerDataset.h index ba11bd5d6d..ba11bd5d6d 100644 --- a/tests/datasets_new/ConvolutionLayerDataset.h +++ b/tests/datasets/ConvolutionLayerDataset.h diff --git a/tests/datasets_new/DepthwiseConvolutionDataset.h b/tests/datasets/DepthwiseConvolutionDataset.h index 93da37532f..93da37532f 100644 --- a/tests/datasets_new/DepthwiseConvolutionDataset.h +++ b/tests/datasets/DepthwiseConvolutionDataset.h diff --git a/tests/datasets_new/DepthwiseSeparableConvolutionLayerDataset.h b/tests/datasets/DepthwiseSeparableConvolutionLayerDataset.h index 4391379833..4391379833 100644 --- a/tests/datasets_new/DepthwiseSeparableConvolutionLayerDataset.h +++ b/tests/datasets/DepthwiseSeparableConvolutionLayerDataset.h diff --git a/tests/datasets_new/DirectConvolutionLayerDataset.h b/tests/datasets/DirectConvolutionLayerDataset.h index 1d7b06ce41..dca38b5858 100644 --- a/tests/datasets_new/DirectConvolutionLayerDataset.h +++ b/tests/datasets/DirectConvolutionLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_DIRECT_CONVOLUTION_LAYER_DATASET #define ARM_COMPUTE_TEST_DIRECT_CONVOLUTION_LAYER_DATASET -#include "tests/datasets_new/ConvolutionLayerDataset.h" +#include "tests/datasets/ConvolutionLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/FullyConnectedLayerDataset.h b/tests/datasets/FullyConnectedLayerDataset.h index 8401e39ece..8401e39ece 100644 --- a/tests/datasets_new/FullyConnectedLayerDataset.h +++ b/tests/datasets/FullyConnectedLayerDataset.h diff --git a/tests/datasets_new/GEMMDataset.h b/tests/datasets/GEMMDataset.h index bb8a328b0c..bb8a328b0c 100644 --- a/tests/datasets_new/GEMMDataset.h +++ b/tests/datasets/GEMMDataset.h diff --git a/tests/datasets_new/InterpolationPolicyDataset.h b/tests/datasets/InterpolationPolicyDataset.h index 154f887962..154f887962 100644 --- a/tests/datasets_new/InterpolationPolicyDataset.h +++ b/tests/datasets/InterpolationPolicyDataset.h diff --git a/tests/datasets_new/LargeConvolutionLayerDataset.h b/tests/datasets/LargeConvolutionLayerDataset.h index 36692f9881..721530ae19 100644 --- a/tests/datasets_new/LargeConvolutionLayerDataset.h +++ b/tests/datasets/LargeConvolutionLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_LARGE_CONVOLUTION_LAYER_DATASET #define ARM_COMPUTE_TEST_LARGE_CONVOLUTION_LAYER_DATASET -#include "tests/datasets_new/ConvolutionLayerDataset.h" +#include "tests/datasets/ConvolutionLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/LargeDepthwiseConvolutionDataset.h b/tests/datasets/LargeDepthwiseConvolutionDataset.h index 8fd87f780d..22b1516d20 100644 --- a/tests/datasets_new/LargeDepthwiseConvolutionDataset.h +++ b/tests/datasets/LargeDepthwiseConvolutionDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_LARGE_DEPTHWISE_CONVOLUTION_DATASET #define ARM_COMPUTE_TEST_LARGE_DEPTHWISE_CONVOLUTION_DATASET -#include "tests/datasets_new/DepthwiseConvolutionDataset.h" +#include "tests/datasets/DepthwiseConvolutionDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/LargeGEMMDataset.h b/tests/datasets/LargeGEMMDataset.h index f757ef34c6..37cdfaa99f 100644 --- a/tests/datasets_new/LargeGEMMDataset.h +++ b/tests/datasets/LargeGEMMDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_LARGE_GEMM_DATASET #define ARM_COMPUTE_TEST_LARGE_GEMM_DATASET -#include "tests/datasets_new/GEMMDataset.h" +#include "tests/datasets/GEMMDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/MatrixMultiplyGEMMDataset.h b/tests/datasets/MatrixMultiplyGEMMDataset.h index 3c482cb244..771403ba96 100644 --- a/tests/datasets_new/MatrixMultiplyGEMMDataset.h +++ b/tests/datasets/MatrixMultiplyGEMMDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_MATRIXMULTIPLY_GEMM_DATASET #define ARM_COMPUTE_TEST_MATRIXMULTIPLY_GEMM_DATASET -#include "tests/datasets_new/GEMMDataset.h" +#include "tests/datasets/GEMMDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/MobileNetDepthwiseConvolutionDataset.h b/tests/datasets/MobileNetDepthwiseConvolutionDataset.h index 377bee6665..c417f18a51 100644 --- a/tests/datasets_new/MobileNetDepthwiseConvolutionDataset.h +++ b/tests/datasets/MobileNetDepthwiseConvolutionDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_MOBILENET_DEPTHWISE_CONVOLUTION_DATASET #define ARM_COMPUTE_TEST_MOBILENET_DEPTHWISE_CONVOLUTION_DATASET -#include "tests/datasets_new/DepthwiseConvolutionDataset.h" +#include "tests/datasets/DepthwiseConvolutionDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/MobileNetDepthwiseSeparableConvolutionLayerDataset.h b/tests/datasets/MobileNetDepthwiseSeparableConvolutionLayerDataset.h index d0d3bb3351..c7784c399c 100644 --- a/tests/datasets_new/MobileNetDepthwiseSeparableConvolutionLayerDataset.h +++ b/tests/datasets/MobileNetDepthwiseSeparableConvolutionLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_MOBILENET_DEPTHWISE_SEPARABLE_CONVOLUTION_LAYER_DATASET #define ARM_COMPUTE_TEST_MOBILENET_DEPTHWISE_SEPARABLE_CONVOLUTION_LAYER_DATASET -#include "tests/datasets_new/DepthwiseSeparableConvolutionLayerDataset.h" +#include "tests/datasets/DepthwiseSeparableConvolutionLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/NormalizationTypesDataset.h b/tests/datasets/NormalizationTypesDataset.h index 4e087e9eff..9b218a7905 100644 --- a/tests/datasets_new/NormalizationTypesDataset.h +++ b/tests/datasets/NormalizationTypesDataset.h @@ -25,6 +25,9 @@ #define __ARM_COMPUTE_TEST_NORMALIZATION_TYPES_DATASET_H__ #include "arm_compute/core/Types.h" +#include "tests/framework/datasets/ContainerDataset.h" + +#include <vector> namespace arm_compute { diff --git a/tests/datasets_new/PoolingLayerDataset.h b/tests/datasets/PoolingLayerDataset.h index 8b35ac6076..e5e9cd70f0 100644 --- a/tests/datasets_new/PoolingLayerDataset.h +++ b/tests/datasets/PoolingLayerDataset.h @@ -24,10 +24,9 @@ #ifndef ARM_COMPUTE_TEST_POOLING_LAYER_DATASET #define ARM_COMPUTE_TEST_POOLING_LAYER_DATASET -#include "tests/TypePrinter.h" - #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" +#include "tests/TypePrinter.h" namespace arm_compute { diff --git a/tests/datasets_new/PoolingTypesDataset.h b/tests/datasets/PoolingTypesDataset.h index 4e4fa26ca4..5ba8aaf6d0 100644 --- a/tests/datasets_new/PoolingTypesDataset.h +++ b/tests/datasets/PoolingTypesDataset.h @@ -25,6 +25,9 @@ #define __ARM_COMPUTE_TEST_POOLING_TYPES_DATASET_H__ #include "arm_compute/core/Types.h" +#include "tests/framework/datasets/ContainerDataset.h" + +#include <vector> namespace arm_compute { diff --git a/tests/datasets_new/ROIPoolingLayerDataset.h b/tests/datasets/ROIPoolingLayerDataset.h index 65d589eb97..65d589eb97 100644 --- a/tests/datasets_new/ROIPoolingLayerDataset.h +++ b/tests/datasets/ROIPoolingLayerDataset.h diff --git a/tests/datasets_new/ReductionOperationDataset.h b/tests/datasets/ReductionOperationDataset.h index e46b8b1118..ce1bcb8501 100644 --- a/tests/datasets_new/ReductionOperationDataset.h +++ b/tests/datasets/ReductionOperationDataset.h @@ -26,6 +26,9 @@ #include "arm_compute/core/Types.h" #include "tests/TypePrinter.h" +#include "tests/framework/datasets/ContainerDataset.h" + +#include <vector> namespace arm_compute { diff --git a/tests/datasets_new/ShapeDatasets.h b/tests/datasets/ShapeDatasets.h index 477d8758cb..4c449a702f 100644 --- a/tests/datasets_new/ShapeDatasets.h +++ b/tests/datasets/ShapeDatasets.h @@ -25,7 +25,7 @@ #define __ARM_COMPUTE_TEST_SHAPE_DATASETS_H__ #include "arm_compute/core/TensorShape.h" -#include "framework/datasets/Datasets.h" +#include "tests/framework/datasets/Datasets.h" #include <type_traits> diff --git a/tests/datasets_new/SmallConvolutionLayerDataset.h b/tests/datasets/SmallConvolutionLayerDataset.h index 59765c4a51..1a26fa5917 100644 --- a/tests/datasets_new/SmallConvolutionLayerDataset.h +++ b/tests/datasets/SmallConvolutionLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_SMALL_CONVOLUTION_LAYER_DATASET #define ARM_COMPUTE_TEST_SMALL_CONVOLUTION_LAYER_DATASET -#include "tests/datasets_new/ConvolutionLayerDataset.h" +#include "tests/datasets/ConvolutionLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/SmallDepthwiseConvolutionDataset.h b/tests/datasets/SmallDepthwiseConvolutionDataset.h index 364673a256..17d01fb5d6 100644 --- a/tests/datasets_new/SmallDepthwiseConvolutionDataset.h +++ b/tests/datasets/SmallDepthwiseConvolutionDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_SMALL_DEPTHWISE_CONVOLUTION_DATASET #define ARM_COMPUTE_TEST_SMALL_DEPTHWISE_CONVOLUTION_DATASET -#include "tests/datasets_new/DepthwiseConvolutionDataset.h" +#include "tests/datasets/DepthwiseConvolutionDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/SmallGEMMDataset.h b/tests/datasets/SmallGEMMDataset.h index 7856ff9127..0cc3c3aa8c 100644 --- a/tests/datasets_new/SmallGEMMDataset.h +++ b/tests/datasets/SmallGEMMDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_SMALL_GEMM_DATASET #define ARM_COMPUTE_TEST_SMALL_GEMM_DATASET -#include "tests/datasets_new/GEMMDataset.h" +#include "tests/datasets/GEMMDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/alexnet/AlexNetActivationLayerDataset.h b/tests/datasets/system_tests/alexnet/AlexNetActivationLayerDataset.h index 7062c2e6b8..4030e97436 100644 --- a/tests/datasets_new/system_tests/alexnet/AlexNetActivationLayerDataset.h +++ b/tests/datasets/system_tests/alexnet/AlexNetActivationLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_ALEXNET_ACTIVATION_LAYER_DATASET #define ARM_COMPUTE_TEST_ALEXNET_ACTIVATION_LAYER_DATASET -#include "framework/datasets/Datasets.h" +#include "tests/framework/datasets/Datasets.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/alexnet/AlexNetConvolutionLayerDataset.h b/tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h index 18421cffe6..d0b901a9a1 100644 --- a/tests/datasets_new/system_tests/alexnet/AlexNetConvolutionLayerDataset.h +++ b/tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_ALEXNET_CONVOLUTION_LAYER_DATASET #define ARM_COMPUTE_TEST_ALEXNET_CONVOLUTION_LAYER_DATASET -#include "tests/datasets_new/ConvolutionLayerDataset.h" +#include "tests/datasets/ConvolutionLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/alexnet/AlexNetFullyConnectedLayerDataset.h b/tests/datasets/system_tests/alexnet/AlexNetFullyConnectedLayerDataset.h index 4aa4f4d861..50b0f7d75d 100644 --- a/tests/datasets_new/system_tests/alexnet/AlexNetFullyConnectedLayerDataset.h +++ b/tests/datasets/system_tests/alexnet/AlexNetFullyConnectedLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_ALEXNET_FULLYCONNECTED_LAYER_DATASET #define ARM_COMPUTE_TEST_ALEXNET_FULLYCONNECTED_LAYER_DATASET -#include "tests/datasets_new/FullyConnectedLayerDataset.h" +#include "tests/datasets/FullyConnectedLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/alexnet/AlexNetNormalizationLayerDataset.h b/tests/datasets/system_tests/alexnet/AlexNetNormalizationLayerDataset.h index 5714c5cf27..33b7423442 100644 --- a/tests/datasets_new/system_tests/alexnet/AlexNetNormalizationLayerDataset.h +++ b/tests/datasets/system_tests/alexnet/AlexNetNormalizationLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_ALEXNET_NORMALIZATION_LAYER_DATASET #define ARM_COMPUTE_TEST_ALEXNET_NORMALIZATION_LAYER_DATASET -#include "framework/datasets/Datasets.h" +#include "tests/framework/datasets/Datasets.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/alexnet/AlexNetPoolingLayerDataset.h b/tests/datasets/system_tests/alexnet/AlexNetPoolingLayerDataset.h index 714bca0777..ab2749b36e 100644 --- a/tests/datasets_new/system_tests/alexnet/AlexNetPoolingLayerDataset.h +++ b/tests/datasets/system_tests/alexnet/AlexNetPoolingLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_ALEXNET_POOLING_LAYER_DATASET #define ARM_COMPUTE_TEST_ALEXNET_POOLING_LAYER_DATASET -#include "tests/datasets_new/PoolingLayerDataset.h" +#include "tests/datasets/PoolingLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ActivationLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ActivationLayerDataset.h index 9f3c38fe66..dc4ffe4e4e 100644 --- a/tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ActivationLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ActivationLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV1_ACTIVATION_LAYER_DATASET #define ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV1_ACTIVATION_LAYER_DATASET -#include "framework/datasets/Datasets.h" +#include "tests/framework/datasets/Datasets.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h index dfa59ab084..a4002d124d 100644 --- a/tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV1_CONVOLUTION_LAYER_DATASET #define ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV1_CONVOLUTION_LAYER_DATASET -#include "tests/datasets_new/ConvolutionLayerDataset.h" +#include "tests/datasets/ConvolutionLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1FullyConnectedLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1FullyConnectedLayerDataset.h index 346bb521ad..80a3473bc7 100644 --- a/tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1FullyConnectedLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1FullyConnectedLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV1_FULLYCONNECTED_LAYER_DATASET #define ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV1_FULLYCONNECTED_LAYER_DATASET -#include "tests/datasets_new/FullyConnectedLayerDataset.h" +#include "tests/datasets/FullyConnectedLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1GEMMDataset.h b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1GEMMDataset.h index 6df3b92397..806ca9378a 100644 --- a/tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1GEMMDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1GEMMDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV1_GEMM_DATASET #define ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV1_GEMM_DATASET -#include "tests/datasets_new/GEMMDataset.h" +#include "tests/datasets/GEMMDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1NormalizationLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1NormalizationLayerDataset.h index 4751dcd511..d8fd061b66 100644 --- a/tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1NormalizationLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1NormalizationLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV1_NORMALIZATION_LAYER_DATASET #define ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV1_NORMALIZATION_LAYER_DATASET -#include "framework/datasets/Datasets.h" +#include "tests/framework/datasets/Datasets.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1PoolingLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1PoolingLayerDataset.h index 007175c4db..6164bbacea 100644 --- a/tests/datasets_new/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1PoolingLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1PoolingLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV1_POOLING_LAYER_DATASET #define ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV1_POOLING_LAYER_DATASET -#include "tests/datasets_new/PoolingLayerDataset.h" +#include "tests/datasets/PoolingLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ActivationLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ActivationLayerDataset.h index d93b548452..2d586390ec 100644 --- a/tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ActivationLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ActivationLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV4_ACTIVATION_LAYER_DATASET #define ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV4_ACTIVATION_LAYER_DATASET -#include "framework/datasets/Datasets.h" +#include "tests/framework/datasets/Datasets.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4BatchNormalizationLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4BatchNormalizationLayerDataset.h index 53bbca4b2f..d96410f9eb 100644 --- a/tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4BatchNormalizationLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4BatchNormalizationLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV4_BATCHNORMALIZATION_LAYER_DATASET #define ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV4_BATCHNORMALIZATION_LAYER_DATASET -#include "tests/datasets_new/BatchNormalizationLayerDataset.h" +#include "tests/datasets/BatchNormalizationLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h index fe0d15ac79..a050d3da74 100644 --- a/tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV4_CONVOLUTION_LAYER_DATASET #define ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV4_CONVOLUTION_LAYER_DATASET -#include "tests/datasets_new/ConvolutionLayerDataset.h" +#include "tests/datasets/ConvolutionLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4FullyConnectedLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4FullyConnectedLayerDataset.h index cf69969197..8cf59e8207 100644 --- a/tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4FullyConnectedLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4FullyConnectedLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV4_FULLYCONNECTED_LAYER_DATASET #define ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV4_FULLYCONNECTED_LAYER_DATASET -#include "tests/datasets_new/FullyConnectedLayerDataset.h" +#include "tests/datasets/FullyConnectedLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h index f0eb1eab42..3b1ee8dcb4 100644 --- a/tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV4_POOLING_LAYER_DATASET #define ARM_COMPUTE_TEST_GOOGLENETINCEPTIONV4_POOLING_LAYER_DATASET -#include "tests/datasets_new/PoolingLayerDataset.h" +#include "tests/datasets/PoolingLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/lenet5/LeNet5ActivationLayerDataset.h b/tests/datasets/system_tests/lenet5/LeNet5ActivationLayerDataset.h index 5d2a36bfd3..4c88cde58d 100644 --- a/tests/datasets_new/system_tests/lenet5/LeNet5ActivationLayerDataset.h +++ b/tests/datasets/system_tests/lenet5/LeNet5ActivationLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_LENET5_ACTIVATION_LAYER_DATASET #define ARM_COMPUTE_TEST_LENET5_ACTIVATION_LAYER_DATASET -#include "framework/datasets/Datasets.h" +#include "tests/framework/datasets/Datasets.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/lenet5/LeNet5ConvolutionLayerDataset.h b/tests/datasets/system_tests/lenet5/LeNet5ConvolutionLayerDataset.h index 446a413663..e1d3ead65b 100644 --- a/tests/datasets_new/system_tests/lenet5/LeNet5ConvolutionLayerDataset.h +++ b/tests/datasets/system_tests/lenet5/LeNet5ConvolutionLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_LENET5_CONVOLUTION_LAYER_DATASET #define ARM_COMPUTE_TEST_LENET5_CONVOLUTION_LAYER_DATASET -#include "tests/datasets_new/ConvolutionLayerDataset.h" +#include "tests/datasets/ConvolutionLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/lenet5/LeNet5FullyConnectedLayerDataset.h b/tests/datasets/system_tests/lenet5/LeNet5FullyConnectedLayerDataset.h index bbbf7121c3..343ecc0190 100644 --- a/tests/datasets_new/system_tests/lenet5/LeNet5FullyConnectedLayerDataset.h +++ b/tests/datasets/system_tests/lenet5/LeNet5FullyConnectedLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_LENET5_FULLYCONNECTED_LAYER_DATASET #define ARM_COMPUTE_TEST_LENET5_FULLYCONNECTED_LAYER_DATASET -#include "tests/datasets_new/FullyConnectedLayerDataset.h" +#include "tests/datasets/FullyConnectedLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/lenet5/LeNet5PoolingLayerDataset.h b/tests/datasets/system_tests/lenet5/LeNet5PoolingLayerDataset.h index bc234d858c..bc2de7b235 100644 --- a/tests/datasets_new/system_tests/lenet5/LeNet5PoolingLayerDataset.h +++ b/tests/datasets/system_tests/lenet5/LeNet5PoolingLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_LENET5_POOLING_LAYER_DATASET #define ARM_COMPUTE_TEST_LENET5_POOLING_LAYER_DATASET -#include "tests/datasets_new/PoolingLayerDataset.h" +#include "tests/datasets/PoolingLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/squeezenet/SqueezeNetActivationLayerDataset.h b/tests/datasets/system_tests/squeezenet/SqueezeNetActivationLayerDataset.h index 9cc9973f8f..7644387384 100644 --- a/tests/datasets_new/system_tests/squeezenet/SqueezeNetActivationLayerDataset.h +++ b/tests/datasets/system_tests/squeezenet/SqueezeNetActivationLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_SQUEEZENET_ACTIVATION_LAYER_DATASET #define ARM_COMPUTE_TEST_SQUEEZENET_ACTIVATION_LAYER_DATASET -#include "framework/datasets/Datasets.h" +#include "tests/framework/datasets/Datasets.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h b/tests/datasets/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h index 07ec6c9eaf..2d447b0156 100644 --- a/tests/datasets_new/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h +++ b/tests/datasets/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_SQUEEZENET_CONVOLUTION_LAYER_DATASET #define ARM_COMPUTE_TEST_SQUEEZENET_CONVOLUTION_LAYER_DATASET -#include "tests/datasets_new/ConvolutionLayerDataset.h" +#include "tests/datasets/ConvolutionLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/squeezenet/SqueezeNetPoolingLayerDataset.h b/tests/datasets/system_tests/squeezenet/SqueezeNetPoolingLayerDataset.h index dc443c8a03..69d04db7e1 100644 --- a/tests/datasets_new/system_tests/squeezenet/SqueezeNetPoolingLayerDataset.h +++ b/tests/datasets/system_tests/squeezenet/SqueezeNetPoolingLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_SQUEEZENET_POOLING_LAYER_DATASET #define ARM_COMPUTE_TEST_SQUEEZENET_POOLING_LAYER_DATASET -#include "tests/datasets_new/PoolingLayerDataset.h" +#include "tests/datasets/PoolingLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/vgg/vgg16/VGG16ActivationLayerDataset.h b/tests/datasets/system_tests/vgg/vgg16/VGG16ActivationLayerDataset.h index 757357f62e..66301ddf08 100644 --- a/tests/datasets_new/system_tests/vgg/vgg16/VGG16ActivationLayerDataset.h +++ b/tests/datasets/system_tests/vgg/vgg16/VGG16ActivationLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_VGG16_ACTIVATION_LAYER_DATASET #define ARM_COMPUTE_TEST_VGG16_ACTIVATION_LAYER_DATASET -#include "framework/datasets/Datasets.h" +#include "tests/framework/datasets/Datasets.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h b/tests/datasets/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h index 4e5b2a6e74..36cb5d93aa 100644 --- a/tests/datasets_new/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h +++ b/tests/datasets/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_VGG16_CONVOLUTION_LAYER_DATASET #define ARM_COMPUTE_TEST_VGG16_CONVOLUTION_LAYER_DATASET -#include "tests/datasets_new/ConvolutionLayerDataset.h" +#include "tests/datasets/ConvolutionLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/vgg/vgg16/VGG16FullyConnectedLayerDataset.h b/tests/datasets/system_tests/vgg/vgg16/VGG16FullyConnectedLayerDataset.h index 19d22ba1a5..d34dc3f87e 100644 --- a/tests/datasets_new/system_tests/vgg/vgg16/VGG16FullyConnectedLayerDataset.h +++ b/tests/datasets/system_tests/vgg/vgg16/VGG16FullyConnectedLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_VGG16_FULLYCONNECTED_LAYER_DATASET #define ARM_COMPUTE_TEST_VGG16_FULLYCONNECTED_LAYER_DATASET -#include "tests/datasets_new/FullyConnectedLayerDataset.h" +#include "tests/datasets/FullyConnectedLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/vgg/vgg16/VGG16PoolingLayerDataset.h b/tests/datasets/system_tests/vgg/vgg16/VGG16PoolingLayerDataset.h index fcd9d2f1c3..4db20870f2 100644 --- a/tests/datasets_new/system_tests/vgg/vgg16/VGG16PoolingLayerDataset.h +++ b/tests/datasets/system_tests/vgg/vgg16/VGG16PoolingLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_VGG16_POOLING_LAYER_DATASET #define ARM_COMPUTE_TEST_VGG16_POOLING_LAYER_DATASET -#include "tests/datasets_new/PoolingLayerDataset.h" +#include "tests/datasets/PoolingLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/yolo/v2/YOLOV2ActivationLayerDataset.h b/tests/datasets/system_tests/yolo/v2/YOLOV2ActivationLayerDataset.h index 31327fa0d2..8a2cd1665e 100644 --- a/tests/datasets_new/system_tests/yolo/v2/YOLOV2ActivationLayerDataset.h +++ b/tests/datasets/system_tests/yolo/v2/YOLOV2ActivationLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_YOLOV2_ACTIVATION_LAYER_DATASET #define ARM_COMPUTE_TEST_YOLOV2_ACTIVATION_LAYER_DATASET -#include "framework/datasets/Datasets.h" +#include "tests/framework/datasets/Datasets.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/yolo/v2/YOLOV2BatchNormalizationLayerDataset.h b/tests/datasets/system_tests/yolo/v2/YOLOV2BatchNormalizationLayerDataset.h index 8cb69db869..cc6a6dcccc 100644 --- a/tests/datasets_new/system_tests/yolo/v2/YOLOV2BatchNormalizationLayerDataset.h +++ b/tests/datasets/system_tests/yolo/v2/YOLOV2BatchNormalizationLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_YOLOV2_BATCHNORMALIZATION_LAYER_DATASET #define ARM_COMPUTE_TEST_YOLOV2_BATCHNORMALIZATION_LAYER_DATASET -#include "tests/datasets_new/BatchNormalizationLayerDataset.h" +#include "tests/datasets/BatchNormalizationLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h b/tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h index ad3c38570e..41f48b0958 100644 --- a/tests/datasets_new/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h +++ b/tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_YOLOV2_CONVOLUTION_LAYER_DATASET #define ARM_COMPUTE_TEST_YOLOV2_CONVOLUTION_LAYER_DATASET -#include "tests/datasets_new/ConvolutionLayerDataset.h" +#include "tests/datasets/ConvolutionLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/datasets_new/system_tests/yolo/v2/YOLOV2PoolingLayerDataset.h b/tests/datasets/system_tests/yolo/v2/YOLOV2PoolingLayerDataset.h index 273409dec6..3763d63588 100644 --- a/tests/datasets_new/system_tests/yolo/v2/YOLOV2PoolingLayerDataset.h +++ b/tests/datasets/system_tests/yolo/v2/YOLOV2PoolingLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_YOLOV2_POOLING_LAYER_DATASET #define ARM_COMPUTE_TEST_YOLOV2_POOLING_LAYER_DATASET -#include "tests/datasets_new/PoolingLayerDataset.h" +#include "tests/datasets/PoolingLayerDataset.h" #include "tests/TypePrinter.h" diff --git a/tests/framework/Asserts.h b/tests/framework/Asserts.h new file mode 100644 index 0000000000..b545a9ebba --- /dev/null +++ b/tests/framework/Asserts.h @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_FRAMEWORK_ASSERTS +#define ARM_COMPUTE_TEST_FRAMEWORK_ASSERTS + +#include "Exceptions.h" +#include "Framework.h" + +#include <sstream> +#include <type_traits> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +// Cast char values to int so that their numeric value are printed. +inline int make_printable(int8_t value) +{ + return value; +} + +inline unsigned int make_printable(uint8_t value) +{ + return value; +} + +// Everything else can be printed as its own type. +template <typename T> +inline T make_printable(T &&value) +{ + return value; +} + +#define ARM_COMPUTE_TEST_INFO(INFO) \ + { \ + std::stringstream info; \ + info << INFO; \ + arm_compute::test::framework::Framework::get().add_test_info(info.str()); \ + } + +namespace detail +{ +#define ARM_COMPUTE_TEST_COMP_FACTORY(SEVERITY, SEVERITY_NAME, COMP, COMP_NAME, ERROR_CALL) \ + template <typename T, typename U> \ + void ARM_COMPUTE_##SEVERITY##_##COMP_NAME##_IMPL(T &&x, U &&y, const std::string &x_str, const std::string &y_str, LogLevel level) \ + { \ + if(!(x COMP y)) \ + { \ + std::stringstream msg; \ + msg << #SEVERITY_NAME " '" << x_str << " " #COMP " " << y_str << "' failed. [" \ + << std::boolalpha << arm_compute::test::framework::make_printable(x) \ + << " " #COMP " " \ + << std::boolalpha << arm_compute::test::framework::make_printable(y) \ + << "]\n"; \ + arm_compute::test::framework::Framework::get().print_test_info(msg); \ + ERROR_CALL \ + } \ + arm_compute::test::framework::Framework::get().clear_test_info(); \ + } + +ARM_COMPUTE_TEST_COMP_FACTORY(EXPECT, Expectation, ==, EQUAL, arm_compute::test::framework::Framework::get().log_failed_expectation(arm_compute::test::framework::TestError(msg.str(), level));) +ARM_COMPUTE_TEST_COMP_FACTORY(EXPECT, Expectation, !=, NOT_EQUAL, arm_compute::test::framework::Framework::get().log_failed_expectation(arm_compute::test::framework::TestError(msg.str(), level));) +ARM_COMPUTE_TEST_COMP_FACTORY(ASSERT, Assertion, ==, EQUAL, throw arm_compute::test::framework::TestError(msg.str(), level);) +ARM_COMPUTE_TEST_COMP_FACTORY(ASSERT, Assertion, !=, NOT_EQUAL, throw arm_compute::test::framework::TestError(msg.str(), level);) +} // namespace detail + +#define ARM_COMPUTE_ASSERT_NOT_EQUAL(X, Y) \ + arm_compute::test::framework::detail::ARM_COMPUTE_ASSERT_NOT_EQUAL_IMPL(X, Y, #X, #Y, LogLevel::ERRORS) + +#define ARM_COMPUTE_ASSERT_EQUAL(X, Y) \ + arm_compute::test::framework::detail::ARM_COMPUTE_ASSERT_EQUAL_IMPL(X, Y, #X, #Y, LogLevel::ERRORS) + +#define ARM_COMPUTE_EXPECT_EQUAL(X, Y, LEVEL) \ + arm_compute::test::framework::detail::ARM_COMPUTE_EXPECT_EQUAL_IMPL(X, Y, #X, #Y, LEVEL) + +#define ARM_COMPUTE_EXPECT_NOT_EQUAL(X, Y, LEVEL) \ + arm_compute::test::framework::detail::ARM_COMPUTE_EXPECT_NOT_EQUAL_IMPL(X, Y, #X, #Y, LEVEL) + +#define ARM_COMPUTE_ASSERT(X) \ + do \ + { \ + const auto &x = X; \ + if(!x) \ + { \ + std::stringstream msg; \ + msg << "Assertion '" #X "' failed.\n"; \ + arm_compute::test::framework::Framework::get().print_test_info(msg); \ + throw arm_compute::test::framework::TestError(msg.str(), arm_compute::test::framework::LogLevel::ERRORS); \ + } \ + arm_compute::test::framework::Framework::get().clear_test_info(); \ + } while(false) + +#define ARM_COMPUTE_EXPECT(X, LEVEL) \ + do \ + { \ + const auto &x = X; \ + if(!x) \ + { \ + std::stringstream msg; \ + msg << "Expectation '" #X "' failed.\n"; \ + arm_compute::test::framework::Framework::get().print_test_info(msg); \ + arm_compute::test::framework::Framework::get().log_failed_expectation(arm_compute::test::framework::TestError(msg.str(), LEVEL)); \ + } \ + arm_compute::test::framework::Framework::get().clear_test_info(); \ + } while(false) +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_FRAMEWORK_ASSERTS */ diff --git a/tests/framework/DatasetModes.cpp b/tests/framework/DatasetModes.cpp new file mode 100644 index 0000000000..3f747df747 --- /dev/null +++ b/tests/framework/DatasetModes.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "DatasetModes.h" + +#include "Utils.h" + +#include <map> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +DatasetMode dataset_mode_from_name(const std::string &name) +{ + static const std::map<std::string, DatasetMode> modes = + { + { "all", DatasetMode::ALL }, + { "precommit", DatasetMode::PRECOMMIT }, + { "nightly", DatasetMode::NIGHTLY }, + }; + + try + { + return modes.at(tolower(name)); + } + catch(const std::out_of_range &) + { + throw std::invalid_argument(name); + } +} +} // namespace framework +} // namespace test +} // namespace arm_compute diff --git a/tests/framework/DatasetModes.h b/tests/framework/DatasetModes.h new file mode 100644 index 0000000000..27638b0504 --- /dev/null +++ b/tests/framework/DatasetModes.h @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_DATASET_MODES +#define ARM_COMPUTE_TEST_DATASET_MODES + +#include <istream> +#include <ostream> +#include <sstream> +#include <stdexcept> +#include <string> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Possible dataset modes. */ +enum class DatasetMode : unsigned int +{ + ALL = ~0U, + DISABLED = 0, + PRECOMMIT = 1, + NIGHTLY = 2 +}; + +inline DatasetMode operator&(DatasetMode t1, DatasetMode t2) +{ + using type = std::underlying_type<DatasetMode>::type; + return static_cast<DatasetMode>(static_cast<type>(t1) & static_cast<type>(t2)); +} + +inline DatasetMode operator|(DatasetMode t1, DatasetMode t2) +{ + using type = std::underlying_type<DatasetMode>::type; + return static_cast<DatasetMode>(static_cast<type>(t1) | static_cast<type>(t2)); +} + +inline DatasetMode &operator|=(DatasetMode &t1, DatasetMode t2) +{ + using type = std::underlying_type<DatasetMode>::type; + t1 = static_cast<DatasetMode>(static_cast<type>(t1) | static_cast<type>(t2)); + return t1; +} + +DatasetMode dataset_mode_from_name(const std::string &name); + +inline ::std::istream &operator>>(::std::istream &stream, DatasetMode &mode) +{ + std::string value; + stream >> value; + mode = dataset_mode_from_name(value); + return stream; +} + +inline ::std::ostream &operator<<(::std::ostream &stream, DatasetMode mode) +{ + switch(mode) + { + case DatasetMode::PRECOMMIT: + stream << "PRECOMMIT"; + break; + case DatasetMode::NIGHTLY: + stream << "NIGHTLY"; + break; + case DatasetMode::ALL: + stream << "ALL"; + break; + default: + throw std::invalid_argument("Unsupported dataset mode"); + } + + return stream; +} + +inline std::string to_string(DatasetMode mode) +{ + std::stringstream stream; + stream << mode; + return stream.str(); +} +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_DATASET_MODES */ diff --git a/tests/framework/Exceptions.cpp b/tests/framework/Exceptions.cpp new file mode 100644 index 0000000000..3d6c65c181 --- /dev/null +++ b/tests/framework/Exceptions.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "Exceptions.h" + +#include "Utils.h" + +#include <map> +#include <sstream> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +LogLevel log_level_from_name(const std::string &name) +{ + static const std::map<std::string, LogLevel> levels = + { + { "none", LogLevel::NONE }, + { "config", LogLevel::CONFIG }, + { "tests", LogLevel::TESTS }, + { "errors", LogLevel::ERRORS }, + { "debug", LogLevel::DEBUG }, + { "measurements", LogLevel::MEASUREMENTS }, + { "all", LogLevel::ALL }, + }; + + try + { + return levels.at(tolower(name)); + } + catch(const std::out_of_range &) + { + throw std::invalid_argument(name); + } +} + +::std::istream &operator>>(::std::istream &stream, LogLevel &level) +{ + std::string value; + stream >> value; + level = log_level_from_name(value); + return stream; +} + +::std::ostream &operator<<(::std::ostream &stream, LogLevel level) +{ + switch(level) + { + case LogLevel::NONE: + stream << "NONE"; + break; + case LogLevel::CONFIG: + stream << "CONFIG"; + break; + case LogLevel::TESTS: + stream << "TESTS"; + break; + case LogLevel::ERRORS: + stream << "ERRORS"; + break; + case LogLevel::DEBUG: + stream << "DEBUG"; + break; + case LogLevel::MEASUREMENTS: + stream << "MEASUREMENTS"; + break; + case LogLevel::ALL: + stream << "ALL"; + break; + default: + throw std::invalid_argument("Unsupported log level"); + } + + return stream; +} + +std::string to_string(LogLevel level) +{ + std::stringstream stream; + stream << level; + return stream.str(); +} + +TestError::TestError(const std::string &msg, LogLevel level, std::string context) + : std::runtime_error{ msg }, _level{ level }, _msg{ msg }, _context{ std::move(context) }, _combined{ "ERROR: " + msg } +{ + if(!_context.empty()) + { + _combined += "\nCONTEXT:\n" + _context; + } +} + +LogLevel TestError::level() const +{ + return _level; +} + +const char *TestError::what() const noexcept +{ + return _combined.c_str(); +} + +} // namespace framework +} // namespace test +} // namespace arm_compute diff --git a/tests/framework/Exceptions.h b/tests/framework/Exceptions.h new file mode 100644 index 0000000000..edb0ed92c9 --- /dev/null +++ b/tests/framework/Exceptions.h @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_EXCEPTIONS +#define ARM_COMPUTE_TEST_EXCEPTIONS + +#include <istream> +#include <ostream> +#include <stdexcept> +#include <string> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Severity of the information. + * + * Each category includes the ones above it. + * + * NONE == Only for filtering. Not used to tag information. + * CONFIG == Configuration info. + * TESTS == Information about the tests. + * ERRORS == Violated assertions/expectations. + * DEBUG == More violated assertions/expectations. + * MEASUREMENTS == Information about measurements. + * ALL == Only for filtering. Not used to tag information. + */ +enum class LogLevel +{ + NONE, + CONFIG, + TESTS, + ERRORS, + DEBUG, + MEASUREMENTS, + ALL, +}; + +LogLevel log_level_from_name(const std::string &name); +::std::istream &operator>>(::std::istream &stream, LogLevel &level); +::std::ostream &operator<<(::std::ostream &stream, LogLevel level); +std::string to_string(LogLevel level); + +/** Error class for failures during test execution. */ +class TestError : public std::runtime_error +{ +public: + using std::runtime_error::runtime_error; + + /** Construct error with severity. + * + * @param[in] msg Error message. + * @param[in] level Severity level. + * @param[in] context Context. + */ + TestError(const std::string &msg, LogLevel level, std::string context = ""); + + /** Severity of the error. + * + * @return Severity. + */ + LogLevel level() const; + + const char *what() const noexcept override; + +private: + LogLevel _level{ LogLevel::ERRORS }; + std::string _msg{}; + std::string _context{}; + std::string _combined{}; +}; +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_EXCEPTIONS */ diff --git a/tests/framework/Fixture.h b/tests/framework/Fixture.h new file mode 100644 index 0000000000..916dcc7fef --- /dev/null +++ b/tests/framework/Fixture.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_FIXTURE +#define ARM_COMPUTE_TEST_FIXTURE + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Abstract fixture class. + * + * All custom fixtures have to inherit from this class. + */ +class Fixture +{ +public: + /** Setup function. + * + * This function is only invoked by non-data fixture test cases. Fixture + * data test cases implement a setup function with arguments matching the + * dataset. + * + * The function is called before the test case is executed. + */ + void setup() {}; + + /** Teardown function. + * + * The function is called after the test case finished. + */ + void teardown() {}; + +protected: + Fixture() = default; + virtual ~Fixture() = default; +}; +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_FIXTURE */ diff --git a/tests/framework/Framework.cpp b/tests/framework/Framework.cpp new file mode 100644 index 0000000000..315f8ebea7 --- /dev/null +++ b/tests/framework/Framework.cpp @@ -0,0 +1,494 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "Framework.h" + +#include "support/ToolchainSupport.h" + +#ifdef ARM_COMPUTE_CL +#include "arm_compute/core/CL/OpenCL.h" +#include "arm_compute/runtime/CL/CLScheduler.h" +#endif /* ARM_COMPUTE_CL */ + +#include <chrono> +#include <iostream> +#include <sstream> +#include <type_traits> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +Framework::Framework() +{ + _available_instruments.emplace(InstrumentType::WALL_CLOCK_TIMER, Instrument::make_instrument<WallClockTimer>); +#ifdef PMU_ENABLED + _available_instruments.emplace(InstrumentType::PMU_CYCLE_COUNTER, Instrument::make_instrument<CycleCounter>); + _available_instruments.emplace(InstrumentType::PMU_INSTRUCTION_COUNTER, Instrument::make_instrument<InstructionCounter>); +#endif /* PMU_ENABLED */ +} + +std::set<InstrumentType> Framework::available_instruments() const +{ + std::set<InstrumentType> types; + + for(const auto &instrument : _available_instruments) + { + types.emplace(instrument.first); + } + + return types; +} + +std::map<TestResult::Status, int> Framework::count_test_results() const +{ + std::map<TestResult::Status, int> counts; + + for(const auto &test : _test_results) + { + ++counts[test.second.status]; + } + + return counts; +} + +Framework &Framework::get() +{ + static Framework instance; + return instance; +} + +void Framework::init(const std::vector<InstrumentType> &instruments, int num_iterations, DatasetMode mode, const std::string &name_filter, const std::string &id_filter, LogLevel log_level) +{ + _test_filter = TestFilter(mode, name_filter, id_filter); + _num_iterations = num_iterations; + _log_level = log_level; + + _instruments = InstrumentType::NONE; + + for(const auto &instrument : instruments) + { + _instruments |= instrument; + } +} + +std::string Framework::current_suite_name() const +{ + return join(_test_suite_name.cbegin(), _test_suite_name.cend(), "/"); +} + +void Framework::push_suite(std::string name) +{ + _test_suite_name.emplace_back(std::move(name)); +} + +void Framework::pop_suite() +{ + _test_suite_name.pop_back(); +} + +void Framework::add_test_info(std::string info) +{ + _test_info.emplace_back(std::move(info)); +} + +void Framework::clear_test_info() +{ + _test_info.clear(); +} + +bool Framework::has_test_info() const +{ + return !_test_info.empty(); +} + +void Framework::print_test_info(std::ostream &os) const +{ + if(!_test_info.empty()) + { + os << "CONTEXT:\n"; + + for(const auto &str : _test_info) + { + os << " " << str << "\n"; + } + } +} + +void Framework::log_test_start(const TestInfo &info) +{ + if(_printer != nullptr && _log_level >= LogLevel::TESTS) + { + _printer->print_test_header(info); + } +} + +void Framework::log_test_skipped(const TestInfo &info) +{ + static_cast<void>(info); +} + +void Framework::log_test_end(const TestInfo &info) +{ + if(_printer != nullptr) + { + if(_log_level >= LogLevel::MEASUREMENTS) + { + _printer->print_measurements(_test_results.at(info).measurements); + } + + if(_log_level >= LogLevel::TESTS) + { + _printer->print_test_footer(); + } + } +} + +void Framework::log_failed_expectation(const TestError &error) +{ + if(_log_level >= error.level() && _printer != nullptr) + { + _printer->print_error(error); + } + + if(_current_test_result != nullptr) + { + _current_test_result->status = TestResult::Status::FAILED; + } +} + +int Framework::num_iterations() const +{ + return _num_iterations; +} + +void Framework::set_num_iterations(int num_iterations) +{ + _num_iterations = num_iterations; +} + +void Framework::set_throw_errors(bool throw_errors) +{ + _throw_errors = throw_errors; +} + +bool Framework::throw_errors() const +{ + return _throw_errors; +} + +void Framework::set_stop_on_error(bool stop_on_error) +{ + _stop_on_error = stop_on_error; +} + +bool Framework::stop_on_error() const +{ + return _stop_on_error; +} + +void Framework::run_test(const TestInfo &info, TestCaseFactory &test_factory) +{ + if(test_factory.status() == TestCaseFactory::Status::DISABLED) + { + log_test_skipped(info); + set_test_result(info, TestResult(TestResult::Status::DISABLED)); + return; + } + + log_test_start(info); + + Profiler profiler = get_profiler(); + TestResult result(TestResult::Status::NOT_RUN); + + _current_test_result = &result; + + if(_log_level >= LogLevel::ERRORS && _printer != nullptr) + { + _printer->print_errors_header(); + } + + try + { + std::unique_ptr<TestCase> test_case = test_factory.make(); + + try + { + test_case->do_setup(); + + for(int i = 0; i < _num_iterations; ++i) + { + profiler.start(); + test_case->do_run(); +#ifdef ARM_COMPUTE_CL + if(opencl_is_available()) + { + CLScheduler::get().sync(); + } +#endif /* ARM_COMPUTE_CL */ + profiler.stop(); + } + + test_case->do_teardown(); + + // Change status to success if no error has happend + if(result.status == TestResult::Status::NOT_RUN) + { + result.status = TestResult::Status::SUCCESS; + } + } + catch(const TestError &error) + { + if(_log_level >= error.level() && _printer != nullptr) + { + _printer->print_error(error); + } + + result.status = TestResult::Status::FAILED; + + if(_throw_errors) + { + throw; + } + } +#ifdef ARM_COMPUTE_CL + catch(const ::cl::Error &error) + { + if(_log_level >= LogLevel::ERRORS && _printer != nullptr) + { + std::stringstream stream; + stream << "Error code: " << error.err(); + _printer->print_error(TestError(error.what(), LogLevel::ERRORS, stream.str())); + } + + result.status = TestResult::Status::FAILED; + + if(_throw_errors) + { + throw; + } + } +#endif /* ARM_COMPUTE_CL */ + catch(const std::exception &error) + { + if(_log_level >= LogLevel::ERRORS && _printer != nullptr) + { + _printer->print_error(error); + } + + result.status = TestResult::Status::CRASHED; + + if(_throw_errors) + { + throw; + } + } + catch(...) + { + if(_log_level >= LogLevel::ERRORS && _printer != nullptr) + { + _printer->print_error(TestError("Received unknown exception")); + } + + result.status = TestResult::Status::CRASHED; + + if(_throw_errors) + { + throw; + } + } + } + catch(const std::exception &error) + { + if(_log_level >= LogLevel::ERRORS && _printer != nullptr) + { + _printer->print_error(error); + } + + result.status = TestResult::Status::CRASHED; + + if(_throw_errors) + { + throw; + } + } + catch(...) + { + if(_log_level >= LogLevel::ERRORS && _printer != nullptr) + { + _printer->print_error(TestError("Received unknown exception")); + } + + result.status = TestResult::Status::CRASHED; + + if(_throw_errors) + { + throw; + } + } + + if(_log_level >= LogLevel::ERRORS && _printer != nullptr) + { + _printer->print_errors_footer(); + } + + _current_test_result = nullptr; + + if(result.status == TestResult::Status::FAILED) + { + if(info.status == TestCaseFactory::Status::EXPECTED_FAILURE) + { + result.status = TestResult::Status::EXPECTED_FAILURE; + } + } + + if(result.status == TestResult::Status::FAILED || result.status == TestResult::Status::CRASHED) + { + if(_stop_on_error) + { + throw std::runtime_error("Abort on first error."); + } + } + + result.measurements = profiler.measurements(); + + set_test_result(info, result); + log_test_end(info); +} + +bool Framework::run() +{ + // Clear old test results + _test_results.clear(); + + if(_printer != nullptr && _log_level >= LogLevel::TESTS) + { + _printer->print_run_header(); + } + + const std::chrono::time_point<std::chrono::high_resolution_clock> start = std::chrono::high_resolution_clock::now(); + + int id = 0; + + for(auto &test_factory : _test_factories) + { + const std::string test_case_name = test_factory->name(); + const TestInfo test_info{ id, test_case_name, test_factory->mode(), test_factory->status() }; + + if(_test_filter.is_selected(test_info)) + { + run_test(test_info, *test_factory); + } + + ++id; + } + + const std::chrono::time_point<std::chrono::high_resolution_clock> end = std::chrono::high_resolution_clock::now(); + + if(_printer != nullptr && _log_level >= LogLevel::TESTS) + { + _printer->print_run_footer(); + } + + auto runtime = std::chrono::duration_cast<std::chrono::seconds>(end - start); + std::map<TestResult::Status, int> results = count_test_results(); + + if(_log_level > LogLevel::NONE) + { + std::cout << "Executed " << _test_results.size() << " test(s) (" + << results[TestResult::Status::SUCCESS] << " passed, " + << results[TestResult::Status::EXPECTED_FAILURE] << " expected failures, " + << results[TestResult::Status::FAILED] << " failed, " + << results[TestResult::Status::CRASHED] << " crashed, " + << results[TestResult::Status::DISABLED] << " disabled) in " << runtime.count() << " second(s)\n"; + } + + int num_successful_tests = results[TestResult::Status::SUCCESS] + results[TestResult::Status::EXPECTED_FAILURE]; + + return (static_cast<unsigned int>(num_successful_tests) == _test_results.size()); +} + +void Framework::set_test_result(TestInfo info, TestResult result) +{ + _test_results.emplace(std::move(info), std::move(result)); +} + +void Framework::print_test_results(Printer &printer) const +{ + printer.print_run_header(); + + for(const auto &test : _test_results) + { + printer.print_test_header(test.first); + printer.print_measurements(test.second.measurements); + printer.print_test_footer(); + } + + printer.print_run_footer(); +} + +Profiler Framework::get_profiler() const +{ + Profiler profiler; + + for(const auto &instrument : _available_instruments) + { + if((instrument.first & _instruments) != InstrumentType::NONE) + { + profiler.add(instrument.second()); + } + } + + return profiler; +} + +void Framework::set_printer(Printer *printer) +{ + _printer = printer; +} + +std::vector<TestInfo> Framework::test_infos() const +{ + std::vector<TestInfo> ids; + + int id = 0; + + for(const auto &factory : _test_factories) + { + TestInfo test_info{ id, factory->name(), factory->mode(), factory->status() }; + + if(_test_filter.is_selected(test_info)) + { + ids.emplace_back(std::move(test_info)); + } + + ++id; + } + + return ids; +} +} // namespace framework +} // namespace test +} // namespace arm_compute diff --git a/tests/framework/Framework.h b/tests/framework/Framework.h new file mode 100644 index 0000000000..055392cdae --- /dev/null +++ b/tests/framework/Framework.h @@ -0,0 +1,330 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_FRAMEWORK +#define ARM_COMPUTE_TEST_FRAMEWORK + +#include "DatasetModes.h" +#include "Exceptions.h" +#include "Profiler.h" +#include "TestCase.h" +#include "TestCaseFactory.h" +#include "TestFilter.h" +#include "TestResult.h" +#include "Utils.h" +#include "instruments/Instruments.h" +#include "printers/Printer.h" + +#include <algorithm> +#include <chrono> +#include <map> +#include <memory> +#include <numeric> +#include <ostream> +#include <regex> +#include <set> +#include <sstream> +#include <string> +#include <tuple> +#include <vector> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Information about a test case. + * + * A test can be identified either via its id or via its name. Additionally + * each test is tagged with the data set mode in which it will be used and + * its status. + * + * @note The mapping between test id and test name is not guaranteed to be + * stable. It is subject to change as new test are added. + */ +struct TestInfo +{ + int id; + std::string name; + DatasetMode mode; + TestCaseFactory::Status status; +}; + +inline bool operator<(const TestInfo &lhs, const TestInfo &rhs) +{ + return lhs.id < rhs.id; +} + +/** Main framework class. + * + * Keeps track of the global state, owns all test cases and collects results. + */ +class Framework final +{ +public: + /** Access to the singleton. + * + * @return Unique instance of the framework class. + */ + static Framework &get(); + + /** Supported instrument types for benchmarking. + * + * @return Set of all available instrument types. + */ + std::set<InstrumentType> available_instruments() const; + + /** Init the framework. + * + * @see TestFilter::TestFilter for the format of the string to filter ids. + * + * @param[in] instruments Instrument types that will be used for benchmarking. + * @param[in] num_iterations Number of iterations per test. + * @param[in] mode Dataset mode. + * @param[in] name_filter Regular expression to filter tests by name. Only matching tests will be executed. + * @param[in] id_filter String to match selected test ids. Only matching tests will be executed. + * @param[in] log_level Verbosity of the output. + */ + void init(const std::vector<InstrumentType> &instruments, int num_iterations, DatasetMode mode, const std::string &name_filter, const std::string &id_filter, LogLevel log_level); + + /** Add a new test suite. + * + * @warning Cannot be used at execution time. It can only be used for + * registering test cases. + * + * @param[in] name Name of the added test suite. + * + * @return Name of the current test suite. + */ + void push_suite(std::string name); + + /** Remove innermost test suite. + * + * @warning Cannot be used at execution time. It can only be used for + * registering test cases. + */ + void pop_suite(); + + /** Add a test case to the framework. + * + * @param[in] test_name Name of the new test case. + * @param[in] mode Mode in which to include the test. + * @param[in] status Status of the test case. + */ + template <typename T> + void add_test_case(std::string test_name, DatasetMode mode, TestCaseFactory::Status status); + + /** Add a data test case to the framework. + * + * @param[in] test_name Name of the new test case. + * @param[in] mode Mode in which to include the test. + * @param[in] status Status of the test case. + * @param[in] description Description of @p data. + * @param[in] data Data that will be used as input to the test. + */ + template <typename T, typename D> + void add_data_test_case(std::string test_name, DatasetMode mode, TestCaseFactory::Status status, std::string description, D &&data); + + /** Add info string for the next expectation/assertion. + * + * @param[in] info Info string. + */ + void add_test_info(std::string info); + + /** Clear the collected test info. */ + void clear_test_info(); + + /** Check if any info has been registered. + * + * @return True if there is test info. + */ + bool has_test_info() const; + + /** Print test info. + * + * @param[out] os Output stream. + */ + void print_test_info(std::ostream &os) const; + + /** Tell the framework that execution of a test starts. + * + * @param[in] info Test info. + */ + void log_test_start(const TestInfo &info); + + /** Tell the framework that a test case is skipped. + * + * @param[in] info Test info. + */ + void log_test_skipped(const TestInfo &info); + + /** Tell the framework that a test case finished. + * + * @param[in] info Test info. + */ + void log_test_end(const TestInfo &info); + + /** Tell the framework that the currently running test case failed a non-fatal expectation. + * + * @param[in] error Description of the error. + */ + void log_failed_expectation(const TestError &error); + + /** Number of iterations per test case. + * + * @return Number of iterations per test case. + */ + int num_iterations() const; + + /** Set number of iterations per test case. + * + * @param[in] num_iterations Number of iterations per test case. + */ + void set_num_iterations(int num_iterations); + + /** Should errors be caught or thrown by the framework. + * + * @return True if errors are thrown. + */ + bool throw_errors() const; + + /** Set whether errors are caught or thrown by the framework. + * + * @param[in] throw_errors True if errors should be thrown. + */ + void set_throw_errors(bool throw_errors); + + /** Indicates if test execution is stopped after the first failed test. + * + * @return True if the execution is going to be aborted after the first failed test. + */ + bool stop_on_error() const; + + /** Set whether to abort execution after the first failed test. + * + * @param[in] stop_on_error True if execution is going to be aborted after first failed test. + */ + void set_stop_on_error(bool stop_on_error); + + /** Run all enabled test cases. + * + * @return True if all test cases executed successful. + */ + bool run(); + + /** Set the result for an executed test case. + * + * @param[in] info Test info. + * @param[in] result Execution result. + */ + void set_test_result(TestInfo info, TestResult result); + + /** Use the specified printer to output test results from the last run. + * + * This method can be used if the test results need to be obtained using a + * different printer than the one managed by the framework. + * + * @param[in] printer Printer used to output results. + */ + void print_test_results(Printer &printer) const; + + /** Factory method to obtain a configured profiler. + * + * The profiler enables all instruments that have been passed to the @ref + * init method. + * + * @return Configured profiler to collect benchmark results. + */ + Profiler get_profiler() const; + + /** Set the printer used for the output of test results. + * + * @param[in] printer Pointer to a printer. + */ + void set_printer(Printer *printer); + + /** List of @ref TestInfo's. + * + * @return Vector with all test ids. + */ + std::vector<TestInfo> test_infos() const; + +private: + Framework(); + ~Framework() = default; + + Framework(const Framework &) = delete; + Framework &operator=(const Framework &) = delete; + + void run_test(const TestInfo &info, TestCaseFactory &test_factory); + std::map<TestResult::Status, int> count_test_results() const; + + /** Returns the current test suite name. + * + * @warning Cannot be used at execution time to get the test suite of the + * currently executed test case. It can only be used for registering test + * cases. + * + * @return Name of the current test suite. + */ + std::string current_suite_name() const; + + std::vector<std::string> _test_suite_name{}; + std::vector<std::unique_ptr<TestCaseFactory>> _test_factories{}; + std::map<TestInfo, TestResult> _test_results{}; + int _num_iterations{ 1 }; + bool _throw_errors{ false }; + bool _stop_on_error{ false }; + Printer *_printer{ nullptr }; + + using create_function = std::unique_ptr<Instrument>(); + std::map<InstrumentType, create_function *> _available_instruments{}; + + InstrumentType _instruments{ InstrumentType::NONE }; + TestFilter _test_filter{}; + LogLevel _log_level{ LogLevel::ALL }; + TestResult *_current_test_result{ nullptr }; + std::vector<std::string> _test_info{}; +}; + +template <typename T> +inline void Framework::add_test_case(std::string test_name, DatasetMode mode, TestCaseFactory::Status status) +{ + _test_factories.emplace_back(support::cpp14::make_unique<SimpleTestCaseFactory<T>>(current_suite_name(), std::move(test_name), mode, status)); +} + +template <typename T, typename D> +inline void Framework::add_data_test_case(std::string test_name, DatasetMode mode, TestCaseFactory::Status status, std::string description, D &&data) +{ + // WORKAROUND for GCC 4.9 + // The function should get *it which is tuple but that seems to trigger a + // bug in the compiler. + auto tmp = std::unique_ptr<DataTestCaseFactory<T, decltype(*std::declval<D>())>>(new DataTestCaseFactory<T, decltype(*std::declval<D>())>(current_suite_name(), std::move(test_name), mode, status, + std::move(description), *data)); + _test_factories.emplace_back(std::move(tmp)); +} +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_FRAMEWORK */ diff --git a/tests/framework/Macros.h b/tests/framework/Macros.h new file mode 100644 index 0000000000..7aabb75cfc --- /dev/null +++ b/tests/framework/Macros.h @@ -0,0 +1,260 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_FRAMEWORK_MACROS +#define ARM_COMPUTE_TEST_FRAMEWORK_MACROS + +#include "Framework.h" +#include "Registrars.h" +#include "TestCase.h" + +// +// TEST SUITE MACROS +// +#define TEST_SUITE(SUITE_NAME) \ + namespace SUITE_NAME##Suite \ + { \ + static arm_compute::test::framework::detail::TestSuiteRegistrar SUITE_NAME##Suite_reg{ #SUITE_NAME }; + +#define TEST_SUITE_END() \ + static arm_compute::test::framework::detail::TestSuiteRegistrar Suite_end; \ + } +// +// TEST SUITE MACROS END +// + +// +// HELPER MACROS +// + +#define CONCAT(ARG0, ARG1) ARG0##ARG1 + +#define VARIADIC_SIZE_IMPL(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, size, ...) size +#define VARIADIC_SIZE(...) VARIADIC_SIZE_IMPL(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) + +#define JOIN_PARAM1(OP, param) OP(0, param) +#define JOIN_PARAM2(OP, param, ...) \ + OP(1, param) \ + , JOIN_PARAM1(OP, __VA_ARGS__) +#define JOIN_PARAM3(OP, param, ...) \ + OP(2, param) \ + , JOIN_PARAM2(OP, __VA_ARGS__) +#define JOIN_PARAM4(OP, param, ...) \ + OP(3, param) \ + , JOIN_PARAM3(OP, __VA_ARGS__) +#define JOIN_PARAM5(OP, param, ...) \ + OP(4, param) \ + , JOIN_PARAM4(OP, __VA_ARGS__) +#define JOIN_PARAM6(OP, param, ...) \ + OP(5, param) \ + , JOIN_PARAM5(OP, __VA_ARGS__) +#define JOIN_PARAM7(OP, param, ...) \ + OP(6, param) \ + , JOIN_PARAM6(OP, __VA_ARGS__) +#define JOIN_PARAM8(OP, param, ...) \ + OP(7, param) \ + , JOIN_PARAM7(OP, __VA_ARGS__) +#define JOIN_PARAM9(OP, param, ...) \ + OP(8, param) \ + , JOIN_PARAM8(OP, __VA_ARGS__) +#define JOIN_PARAM10(OP, param, ...) \ + OP(9, param) \ + , JOIN_PARAM9(OP, __VA_ARGS__) +#define JOIN_PARAM(OP, NUM, ...) \ + CONCAT(JOIN_PARAM, NUM) \ + (OP, __VA_ARGS__) + +#define MAKE_TYPE_PARAM(i, name) typename T##i +#define MAKE_ARG_PARAM(i, name) const T##i &name +#define MAKE_TYPE_PARAMS(...) JOIN_PARAM(MAKE_TYPE_PARAM, VARIADIC_SIZE(__VA_ARGS__), __VA_ARGS__) +#define MAKE_ARG_PARAMS(...) JOIN_PARAM(MAKE_ARG_PARAM, VARIADIC_SIZE(__VA_ARGS__), __VA_ARGS__) + +// +// TEST CASE MACROS +// +#define TEST_CASE_CONSTRUCTOR(TEST_NAME) \ + TEST_NAME() = default; +#define DATA_TEST_CASE_CONSTRUCTOR(TEST_NAME, DATASET) \ + template <typename D> \ + explicit TEST_NAME(D &&data) : DataTestCase{ std::forward<D>(data) } \ + { \ + } +#define FIXTURE_SETUP(FIXTURE) \ + void do_setup() override \ + { \ + FIXTURE::setup(); \ + } +#define FIXTURE_DATA_SETUP(FIXTURE) \ + void do_setup() override \ + { \ + apply(this, &FIXTURE::setup<As...>, _data); \ + } +#define FIXTURE_RUN(FIXTURE) \ + void do_run() override \ + { \ + FIXTURE::run(); \ + } +#define FIXTURE_TEARDOWN(FIXTURE) \ + void do_teardown() override \ + { \ + FIXTURE::teardown(); \ + } +#define TEST_REGISTRAR(TEST_NAME, MODE, STATUS) \ + static arm_compute::test::framework::detail::TestCaseRegistrar<TEST_NAME> TEST_NAME##_reg \ + { \ + #TEST_NAME, MODE, STATUS \ + } +#define DATA_TEST_REGISTRAR(TEST_NAME, MODE, STATUS, DATASET) \ + static arm_compute::test::framework::detail::TestCaseRegistrar<TEST_NAME<decltype(DATASET)::type>> TEST_NAME##_reg \ + { \ + #TEST_NAME, MODE, STATUS, DATASET \ + } + +#define TEST_CASE_IMPL(TEST_NAME, MODE, STATUS) \ + class TEST_NAME : public arm_compute::test::framework::TestCase \ + { \ + public: \ + TEST_CASE_CONSTRUCTOR(TEST_NAME) \ + void do_run() override; \ + }; \ + TEST_REGISTRAR(TEST_NAME, MODE, STATUS); \ + void TEST_NAME::do_run() + +#define TEST_CASE(TEST_NAME, MODE) \ + TEST_CASE_IMPL(TEST_NAME, MODE, arm_compute::test::framework::TestCaseFactory::Status::ACTIVE) +#define EXPECTED_FAILURE_TEST_CASE(TEST_NAME, MODE) \ + TEST_CASE_IMPL(TEST_NAME, MODE, arm_compute::test::framework::TestCaseFactory::Status::EXPECTED_FAILURE) +#define DISABLED_TEST_CASE(TEST_NAME, MODE) \ + TEST_CASE_IMPL(TEST_NAME, MODE, arm_compute::test::framework::TestCaseFactory::Status::DISABLED) + +#define DATA_TEST_CASE_IMPL(TEST_NAME, MODE, STATUS, DATASET, ...) \ + template <typename T> \ + class TEST_NAME; \ + template <typename... As> \ + class TEST_NAME<std::tuple<As...>> : public arm_compute::test::framework::DataTestCase<decltype(DATASET)::type> \ + { \ + public: \ + DATA_TEST_CASE_CONSTRUCTOR(TEST_NAME, DATASET) \ + void do_run() override \ + { \ + arm_compute::test::framework::apply(this, &TEST_NAME::run<As...>, _data); \ + } \ + template <MAKE_TYPE_PARAMS(__VA_ARGS__)> \ + void run(MAKE_ARG_PARAMS(__VA_ARGS__)); \ + }; \ + DATA_TEST_REGISTRAR(TEST_NAME, MODE, STATUS, DATASET); \ + template <typename... As> \ + template <MAKE_TYPE_PARAMS(__VA_ARGS__)> \ + void TEST_NAME<std::tuple<As...>>::run(MAKE_ARG_PARAMS(__VA_ARGS__)) + +#define DATA_TEST_CASE(TEST_NAME, MODE, DATASET, ...) \ + DATA_TEST_CASE_IMPL(TEST_NAME, MODE, arm_compute::test::framework::TestCaseFactory::Status::ACTIVE, DATASET, __VA_ARGS__) +#define EXPECTED_FAILURE_DATA_TEST_CASE(TEST_NAME, MODE, DATASET, ...) \ + DATA_TEST_CASE_IMPL(TEST_NAME, MODE, arm_compute::test::framework::TestCaseFactory::Status::EXPECTED_FAILURE, DATASET, __VA_ARGS__) +#define DISABLED_DATA_TEST_CASE(TEST_NAME, MODE, DATASET, ...) \ + DATA_TEST_CASE_IMPL(TEST_NAME, MODE, arm_compute::test::framework::TestCaseFactory::Status::DISABLED, DATASET, __VA_ARGS__) + +#define FIXTURE_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, STATUS) \ + class TEST_NAME : public arm_compute::test::framework::TestCase, public FIXTURE \ + { \ + public: \ + TEST_CASE_CONSTRUCTOR(TEST_NAME) \ + FIXTURE_SETUP(FIXTURE) \ + void do_run() override; \ + FIXTURE_TEARDOWN(FIXTURE) \ + }; \ + TEST_REGISTRAR(TEST_NAME, MODE, STATUS); \ + void TEST_NAME::do_run() + +#define FIXTURE_TEST_CASE(TEST_NAME, FIXTURE, MODE) \ + FIXTURE_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, arm_compute::test::framework::TestCaseFactory::Status::ACTIVE) +#define EXPECTED_FAILURE_FIXTURE_TEST_CASE(TEST_NAME, FIXTURE, MODE) \ + FIXTURE_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, arm_compute::test::framework::TestCaseFactory::Status::EXPECTED_FAILURE) +#define DISABLED_FIXTURE_TEST_CASE(TEST_NAME, FIXTURE, MODE) \ + FIXTURE_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, arm_compute::test::framework::TestCaseFactory::Status::DISABLED) + +#define FIXTURE_DATA_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, STATUS, DATASET) \ + template <typename T> \ + class TEST_NAME; \ + template <typename... As> \ + class TEST_NAME<std::tuple<As...>> : public arm_compute::test::framework::DataTestCase<decltype(DATASET)::type>, public FIXTURE \ + { \ + public: \ + DATA_TEST_CASE_CONSTRUCTOR(TEST_NAME, DATASET) \ + FIXTURE_DATA_SETUP(FIXTURE) \ + void do_run() override; \ + FIXTURE_TEARDOWN(FIXTURE) \ + }; \ + DATA_TEST_REGISTRAR(TEST_NAME, MODE, STATUS, DATASET); \ + template <typename... As> \ + void TEST_NAME<std::tuple<As...>>::do_run() + +#define FIXTURE_DATA_TEST_CASE(TEST_NAME, FIXTURE, MODE, DATASET) \ + FIXTURE_DATA_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, arm_compute::test::framework::TestCaseFactory::Status::ACTIVE, DATASET) +#define EXPECTED_FAILURE_FIXTURE_DATA_TEST_CASE(TEST_NAME, FIXTURE, MODE, DATASET) \ + FIXTURE_DATA_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, arm_compute::test::framework::TestCaseFactory::Status::EXPECTED_FAILURE, DATASET) +#define DISABLED_FIXTURE_DATA_TEST_CASE(TEST_NAME, FIXTURE, MODE, DATASET) \ + FIXTURE_DATA_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, arm_compute::test::framework::TestCaseFactory::Status::DISABLED, DATASET) + +#define REGISTER_FIXTURE_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, STATUS) \ + class TEST_NAME : public arm_compute::test::framework::TestCase, public FIXTURE \ + { \ + public: \ + TEST_CASE_CONSTRUCTOR(TEST_NAME) \ + FIXTURE_SETUP(FIXTURE) \ + FIXTURE_RUN(FIXTURE) \ + FIXTURE_TEARDOWN(FIXTURE) \ + }; \ + TEST_REGISTRAR(TEST_NAME, MODE, STATUS) + +#define REGISTER_FIXTURE_TEST_CASE(TEST_NAME, FIXTURE, MODE) \ + REGISTER_FIXTURE_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, arm_compute::test::framework::TestCaseFactory::Status::ACTIVE) +#define EXPECTED_FAILURE_REGISTER_FIXTURE_TEST_CASE(TEST_NAME, FIXTURE, MODE) \ + REGISTER_FIXTURE_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, arm_compute::test::framework::TestCaseFactory::Status::EXPECTED_FAILURE) +#define DISABLED_REGISTER_FIXTURE_TEST_CASE(TEST_NAME, FIXTURE, MODE) \ + REGISTER_FIXTURE_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, arm_compute::test::framework::TestCaseFactory::Status::DISABLED) + +#define REGISTER_FIXTURE_DATA_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, STATUS, DATASET) \ + template <typename T> \ + class TEST_NAME; \ + template <typename... As> \ + class TEST_NAME<std::tuple<As...>> : public arm_compute::test::framework::DataTestCase<decltype(DATASET)::type>, public FIXTURE \ + { \ + public: \ + DATA_TEST_CASE_CONSTRUCTOR(TEST_NAME, DATASET) \ + FIXTURE_DATA_SETUP(FIXTURE) \ + FIXTURE_RUN(FIXTURE) \ + FIXTURE_TEARDOWN(FIXTURE) \ + }; \ + DATA_TEST_REGISTRAR(TEST_NAME, MODE, STATUS, DATASET) + +#define REGISTER_FIXTURE_DATA_TEST_CASE(TEST_NAME, FIXTURE, MODE, DATASET) \ + REGISTER_FIXTURE_DATA_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, arm_compute::test::framework::TestCaseFactory::Status::ACTIVE, DATASET) +#define EXPECTED_FAILURE_REGISTER_FIXTURE_DATA_TEST_CASE(TEST_NAME, FIXTURE, MODE, DATASET) \ + REGISTER_FIXTURE_DATA_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, arm_compute::test::framework::TestCaseFactory::Status::EXPECTED_FAILURE, DATASET) +#define DISABLED_REGISTER_FIXTURE_DATA_TEST_CASE(TEST_NAME, FIXTURE, MODE, DATASET) \ + REGISTER_FIXTURE_DATA_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, arm_compute::test::framework::TestCaseFactory::Status::DISABLED, DATASET) +// +// TEST CASE MACROS END +// +#endif /* ARM_COMPUTE_TEST_FRAMEWORK_MACROS */ diff --git a/tests/framework/Profiler.cpp b/tests/framework/Profiler.cpp new file mode 100644 index 0000000000..76de9a818f --- /dev/null +++ b/tests/framework/Profiler.cpp @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "Profiler.h" + +#include <iostream> +#include <utility> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +void Profiler::add(std::unique_ptr<Instrument> instrument) +{ + _instruments.emplace_back(std::move(instrument)); +} + +void Profiler::start() +{ + for(auto &instrument : _instruments) + { + instrument->start(); + } +} + +void Profiler::stop() +{ + for(auto &instrument : _instruments) + { + instrument->stop(); + } + + for(const auto &instrument : _instruments) + { + _measurements[instrument->id()].push_back(instrument->measurement()); + } +} + +const Profiler::MeasurementsMap &Profiler::measurements() const +{ + return _measurements; +} +} // namespace framework +} // namespace test +} // namespace arm_compute diff --git a/tests/framework/Profiler.h b/tests/framework/Profiler.h new file mode 100644 index 0000000000..1454c0f875 --- /dev/null +++ b/tests/framework/Profiler.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_PROFILER +#define ARM_COMPUTE_TEST_PROFILER + +#include "instruments/Instrument.h" + +#include <map> +#include <memory> +#include <string> +#include <vector> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Profiler class to collect benchmark numbers. + * + * A profiler manages multiple instruments that can collect different types of benchmarking numbers. + */ +class Profiler +{ +public: + /** Mapping from instrument ids to their measurements. */ + using MeasurementsMap = std::map<std::string, std::vector<Instrument::Measurement>>; + + /** Add @p instrument to the performance monitor. + * + * All added instruments will be used when @ref start or @ref stop are + * called to make measurements. + * + * @param[in] instrument Instrument to be used to measure performance. + */ + void add(std::unique_ptr<Instrument> instrument); + + /** Start all added instruments to measure performance. */ + void start(); + + /** Stop all added instruments. */ + void stop(); + + /** Return measurements for all instruments. */ + const MeasurementsMap &measurements() const; + +private: + std::vector<std::unique_ptr<Instrument>> _instruments{}; + MeasurementsMap _measurements{}; +}; +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_PROFILER */ diff --git a/tests/framework/Registrars.h b/tests/framework/Registrars.h new file mode 100644 index 0000000000..ca23edf0de --- /dev/null +++ b/tests/framework/Registrars.h @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_FRAMEWORK_REGISTRARS +#define ARM_COMPUTE_TEST_FRAMEWORK_REGISTRARS + +#include "DatasetModes.h" +#include "Framework.h" + +#include <string> +#include <utility> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +namespace detail +{ +/** Helper class to statically register a test case. */ +template <typename T> +class TestCaseRegistrar final +{ +public: + /** Add a new test case with the given name to the framework. + * + * @param[in] test_name Name of the test case. + * @param[in] mode Mode in which the test should be activated. + * @param[in] status Status of the test case. + */ + TestCaseRegistrar(std::string test_name, DatasetMode mode, TestCaseFactory::Status status); + + /** Add a new data test case with the given name to the framework. + * + * @param[in] test_name Name of the test case. + * @param[in] mode Mode in which the test should be activated. + * @param[in] status Status of the test case. + * @param[in] dataset Dataset used as input for the test case. + */ + template <typename D> + TestCaseRegistrar(std::string test_name, DatasetMode mode, TestCaseFactory::Status status, D &&dataset); +}; + +/** Helper class to statically begin and end a test suite. */ +class TestSuiteRegistrar final +{ +public: + /** Remove the last added test suite from the framework. */ + TestSuiteRegistrar(); + + /** Add a new test suite with the given name to the framework. + * + * @param[in] name Name of the test suite. + */ + TestSuiteRegistrar(std::string name); +}; + +template <typename T> +inline TestCaseRegistrar<T>::TestCaseRegistrar(std::string test_name, DatasetMode mode, TestCaseFactory::Status status) +{ + Framework::get().add_test_case<T>(std::move(test_name), mode, status); +} + +template <typename T> +template <typename D> +inline TestCaseRegistrar<T>::TestCaseRegistrar(std::string test_name, DatasetMode mode, TestCaseFactory::Status status, D &&dataset) +{ + auto it = dataset.begin(); + + for(int i = 0; i < dataset.size(); ++i, ++it) + { + // WORKAROUND for GCC 4.9 + // The last argument should be *it to pass just the data and not the + // iterator. + Framework::get().add_data_test_case<T>(test_name, mode, status, it.description(), it); + } +} + +inline TestSuiteRegistrar::TestSuiteRegistrar() +{ + Framework::get().pop_suite(); +} + +inline TestSuiteRegistrar::TestSuiteRegistrar(std::string name) +{ + Framework::get().push_suite(std::move(name)); +} +} // namespace detail +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_FRAMEWORK_REGISTRARS */ diff --git a/tests/framework/SConscript b/tests/framework/SConscript new file mode 100644 index 0000000000..36632515a3 --- /dev/null +++ b/tests/framework/SConscript @@ -0,0 +1,71 @@ +# Copyright (c) 2017 ARM Limited. +# +# SPDX-License-Identifier: MIT +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +import SCons +import os.path + +Import('env') +Import('vars') + +# vars is imported from arm_compute: +variables = [ + BoolVariable("pmu", "Enable PMU counters", False) +] + +# We need a separate set of Variables for the Help message (Otherwise the global variables will get displayed twice) +new_options = Variables('scons') + +for v in variables: + new_options.Add(v) + vars.Add(v) + +# Clone the environment to make sure we're not polluting the arm_compute one: +framework_env = env.Clone() +vars.Update(framework_env) + +Help(new_options.GenerateHelpText(framework_env)) + +if env['os'] == 'android' and framework_env['pmu']: + print("pmu=1 is not supported for os=android") + Exit(1) + +if(env['opencl']): + framework_env.Append(CPPDEFINES=['ARM_COMPUTE_CL']) + +framework_env.Append(CPPPATH = ["."]) +framework_env.Append(CPPFLAGS=['-Wno-overloaded-virtual']) + +files = Glob('*.cpp') +files += Glob('command_line/*.cpp') +files += Glob('printers/*.cpp') +files += Glob('datasets/*.cpp') +files += Glob('instruments/*.cpp') + +if not framework_env['pmu']: + # Remove PMU files + files = [f for f in files if "PMU" not in os.path.basename(str(f))] +else: + framework_env.Append(CPPDEFINES = ['PMU_ENABLED']) + +arm_compute_test_framework = framework_env.StaticLibrary('arm_compute_test_framework', files) + +Default(arm_compute_test_framework) +Export('arm_compute_test_framework') diff --git a/tests/framework/TestCase.h b/tests/framework/TestCase.h new file mode 100644 index 0000000000..dbb9312dee --- /dev/null +++ b/tests/framework/TestCase.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_TESTCASE +#define ARM_COMPUTE_TEST_TESTCASE + +#include <string> +#include <utility> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Abstract test case class. + * + * All test cases have to inherit from this class. + */ +class TestCase +{ +public: + virtual void do_setup() {}; + virtual void do_run() {}; + virtual void do_teardown() {}; + + /** Default destructor. */ + virtual ~TestCase() = default; + +protected: + TestCase() = default; + + friend class TestCaseFactory; +}; + +template <typename T> +class DataTestCase : public TestCase +{ +protected: + explicit DataTestCase(T data) + : _data{ std::move(data) } + { + } + + T _data; +}; +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_TESTCASE */ diff --git a/tests/framework/TestCaseFactory.h b/tests/framework/TestCaseFactory.h new file mode 100644 index 0000000000..b8c8cdbeb0 --- /dev/null +++ b/tests/framework/TestCaseFactory.h @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_TEST_CASE_FACTORY +#define ARM_COMPUTE_TEST_TEST_CASE_FACTORY + +#include "DatasetModes.h" +#include "TestCase.h" +#include "support/ToolchainSupport.h" + +#include <memory> +#include <string> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Abstract factory class to create test cases. */ +class TestCaseFactory +{ +public: + /** Test case status. + * + * ACTIVE == Test is run and result is validated. Failure on failed validation. + * EXPECTED_FAILURE == Test is run and result is validated. Failure on successful validation. + * DISABLED == Test is not run. + */ + enum class Status + { + ACTIVE, + EXPECTED_FAILURE, + DISABLED + }; + + /** Constructor. + * + * @param[in] suite_name Name of the test suite to which the test case has been added. + * @param[in] name Name of the test case. + * @param[in] mode Datset mode of the test case. + * @param[in] status Status of the test case. + * @param[in] description Description of data arguments. + */ + TestCaseFactory(std::string suite_name, std::string name, DatasetMode mode, Status status, std::string description = ""); + + /** Default destructor. */ + virtual ~TestCaseFactory() = default; + + /** Name of the test case. + * + * @return Name of the test case. + */ + std::string name() const; + + /** Get the mode for which test case will be enabled. + * + * @return Dataset mode of the test case. + */ + DatasetMode mode() const; + + /** Get the status of the test case. + * + * @return Status of the test case. + */ + Status status() const; + + /** Factory function to create the test case + * + * @return Unique pointer to a newly created test case. + */ + virtual std::unique_ptr<TestCase> make() const = 0; + +private: + const std::string _suite_name; + const std::string _test_name; + const std::string _data_description; + const DatasetMode _mode{ DatasetMode::ALL }; + const Status _status{ Status::ACTIVE }; +}; + +/** Implementation of a test case factory to create non-data test cases. */ +template <typename T> +class SimpleTestCaseFactory final : public TestCaseFactory +{ +public: + /** Default constructor. */ + using TestCaseFactory::TestCaseFactory; + + std::unique_ptr<TestCase> make() const override; +}; + +template <typename T, typename D> +class DataTestCaseFactory final : public TestCaseFactory +{ +public: + /** Constructor. + * + * @param[in] suite_name Name of the test suite to which the test case has been added. + * @param[in] test_name Name of the test case. + * @param[in] mode Mode in which the test case is enabled. + * @param[in] status Status of the test case. + * @param[in] description Description of data arguments. + * @param[in] data Input data for the test case. + */ + DataTestCaseFactory(std::string suite_name, std::string test_name, DatasetMode mode, Status status, std::string description, const D &data); + + std::unique_ptr<TestCase> make() const override; + +private: + D _data; +}; + +inline TestCaseFactory::TestCaseFactory(std::string suite_name, std::string test_name, DatasetMode mode, Status status, std::string description) + : _suite_name{ std::move(suite_name) }, _test_name{ std::move(test_name) }, _data_description{ std::move(description) }, _mode{ mode }, _status{ status } + +{ +} + +inline std::string TestCaseFactory::name() const +{ + std::string name = _suite_name + "/" + _test_name; + + if(!_data_description.empty()) + { + name += "@" + _data_description; + } + + return name; +} + +inline DatasetMode TestCaseFactory::mode() const +{ + return _mode; +} + +inline TestCaseFactory::Status TestCaseFactory::status() const +{ + return _status; +} + +inline ::std::ostream &operator<<(::std::ostream &stream, TestCaseFactory::Status status) +{ + switch(status) + { + case TestCaseFactory::Status::ACTIVE: + stream << "ACTIVE"; + break; + case TestCaseFactory::Status::EXPECTED_FAILURE: + stream << "EXPECTED_FAILURE"; + break; + case TestCaseFactory::Status::DISABLED: + stream << "DISABLED"; + break; + default: + throw std::invalid_argument("Unsupported test case factory status"); + } + + return stream; +} + +template <typename T> +inline std::unique_ptr<TestCase> SimpleTestCaseFactory<T>::make() const +{ + return support::cpp14::make_unique<T>(); +} + +template <typename T, typename D> +inline DataTestCaseFactory<T, D>::DataTestCaseFactory(std::string suite_name, std::string test_name, DatasetMode mode, Status status, std::string description, const D &data) + : TestCaseFactory{ std::move(suite_name), std::move(test_name), mode, status, std::move(description) }, _data{ data } +{ +} + +template <typename T, typename D> +inline std::unique_ptr<TestCase> DataTestCaseFactory<T, D>::make() const +{ + return support::cpp14::make_unique<T>(_data); +} +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_TEST_CASE_FACTORY */ diff --git a/tests/framework/TestFilter.cpp b/tests/framework/TestFilter.cpp new file mode 100644 index 0000000000..0af40c1717 --- /dev/null +++ b/tests/framework/TestFilter.cpp @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "TestFilter.h" + +#include "Framework.h" +#include "support/ToolchainSupport.h" + +#include <sstream> +#include <string> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +TestFilter::TestFilter(DatasetMode mode, const std::string &name_filter, const std::string &id_filter) + : _dataset_mode{ mode }, _name_filter{ name_filter }, _id_filter{ parse_id_filter(id_filter) } +{ +} + +bool TestFilter::is_selected(const TestInfo &info) const +{ + if((info.mode & _dataset_mode) == DatasetMode::DISABLED) + { + return false; + } + + if(!std::regex_search(info.name, _name_filter)) + { + return false; + } + + if(!_id_filter.empty()) + { + bool found = false; + + for(const auto range : _id_filter) + { + if(range.first <= info.id && info.id <= range.second) + { + found = true; + break; + } + } + + if(!found) + { + return false; + } + } + + return true; +} + +TestFilter::Ranges TestFilter::parse_id_filter(const std::string &id_filter) const +{ + Ranges ranges; + std::string str; + bool in_range = false; + int value = 0; + int start = 0; + int end = std::numeric_limits<int>::max(); + + std::stringstream stream(id_filter); + + // Get first value + std::getline(stream, str, ','); + + if(stream.fail()) + { + return ranges; + } + + if(str.find("...") != std::string::npos) + { + in_range = true; + } + else + { + start = support::cpp11::stoi(str); + end = start; + } + + while(!stream.eof()) + { + std::getline(stream, str, ','); + + if(stream.fail()) + { + break; + } + + if(str.find("...") != std::string::npos) + { + end = std::numeric_limits<int>::max(); + in_range = true; + } + else + { + value = support::cpp11::stoi(str); + + if(in_range || end == value - 1) + { + end = value; + in_range = false; + } + else + { + ranges.emplace_back(start, end); + start = value; + end = start; + } + } + } + + ranges.emplace_back(start, end); + return ranges; +} +} // namespace framework +} // namespace test +} // namespace arm_compute diff --git a/tests/framework/TestFilter.h b/tests/framework/TestFilter.h new file mode 100644 index 0000000000..f64e73a2ba --- /dev/null +++ b/tests/framework/TestFilter.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_TESTFILTER +#define ARM_COMPUTE_TEST_TESTFILTER + +#include "DatasetModes.h" + +#include <regex> +#include <utility> +#include <vector> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +struct TestInfo; + +/** Test filter class. + * + * Stores information about which test cases are selected for execution. Based + * on test name and test id. + */ +class TestFilter final +{ +public: + /** Default constructor. All tests selected. */ + TestFilter() = default; + + /** Constructor. + * + * The id_filter string has be a comma separated list of test ids. ... can + * be used to include a range of tests. For instance, "..., 15" means all + * test up to and including 15, "3, 6, ..., 10" means tests 3 and 6 to 10, + * and "15, ..." means test 15 and all following. + * + * @param[in] mode Dataset mode. + * @param[in] name_filter Regular expression to filter tests by name. Only matching tests will be executed. + * @param[in] id_filter String to match selected test ids. Only matching tests will be executed. + */ + TestFilter(DatasetMode mode, const std::string &name_filter, const std::string &id_filter); + + /** Check if a test case is selected to be executed. + * + * @param[in] info Test case info. + * + * @return True if the test case is selected to be executed. + */ + bool is_selected(const TestInfo &info) const; + +private: + using Ranges = std::vector<std::pair<int, int>>; + Ranges parse_id_filter(const std::string &id_filter) const; + + DatasetMode _dataset_mode{ DatasetMode::ALL }; + std::regex _name_filter{ ".*" }; + Ranges _id_filter{}; +}; +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_TESTFILTER */ diff --git a/tests/framework/TestResult.h b/tests/framework/TestResult.h new file mode 100644 index 0000000000..e71ef95112 --- /dev/null +++ b/tests/framework/TestResult.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_TESTRESULT +#define ARM_COMPUTE_TEST_TESTRESULT + +#include "Profiler.h" + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Class to store results of a test. + * + * Currently the execution status and profiling information are stored. + */ +struct TestResult +{ + /** Execution status of a test. */ + enum class Status + { + NOT_RUN, + SUCCESS, + EXPECTED_FAILURE, + FAILED, + CRASHED, + DISABLED + }; + + /** Default constructor. */ + TestResult() = default; + + /** Initialise the result with a status. + * + * @param[in] status Execution status. + */ + TestResult(Status status) + : status{ status } + { + } + + /** Initialise the result with a status and profiling information. + * + * @param[in] status Execution status. + * @param[in] measurements Profiling information. + */ + TestResult(Status status, const Profiler::MeasurementsMap &measurements) + : status{ status }, measurements{ measurements } + { + } + + Status status{ Status::NOT_RUN }; //< Execution status + Profiler::MeasurementsMap measurements{}; //< Profiling information +}; +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_TESTRESULT */ diff --git a/tests/framework/Utils.h b/tests/framework/Utils.h new file mode 100644 index 0000000000..a9fe0dcaa3 --- /dev/null +++ b/tests/framework/Utils.h @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_UTILS +#define ARM_COMPUTE_TEST_UTILS + +#include "support/ToolchainSupport.h" + +#include <algorithm> +#include <cmath> +#include <cstddef> +#include <limits> +#include <memory> +#include <numeric> +#include <sstream> +#include <string> +#include <type_traits> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** @cond */ +namespace detail +{ +template <int...> +struct sequence +{ +}; + +template <int N, int... Ns> +struct sequence_generator; + +template <int... Ns> +struct sequence_generator<0, Ns...> +{ + using type = sequence<Ns...>; +}; + +template <int N, int... Ns> +struct sequence_generator : sequence_generator < N - 1, N - 1, Ns... > +{ +}; + +template <int N> +using sequence_t = typename sequence_generator<N>::type; +/** @endcond */ + +template <typename O, typename F, typename... As, int... S> +void apply_impl(O *obj, F &&func, const std::tuple<As...> &args, detail::sequence<S...>) +{ + (obj->*func)(std::get<S>(args)...); +} +} // namespace + +template <typename O, typename F, typename... As> +void apply(O *obj, F &&func, const std::tuple<As...> &args) +{ + detail::apply_impl(obj, std::forward<F>(func), args, detail::sequence_t<sizeof...(As)>()); +} + +/** Helper function to concatenate multiple strings. + * + * @param[in] first Iterator pointing to the first element to be concatenated. + * @param[in] last Iterator pointing behind the last element to be concatenated. + * @param[in] separator String used to join the elements. + * + * @return String containing all elements joined by @p separator. + */ +template <typename T, typename std::enable_if<std::is_same<typename T::value_type, std::string>::value, int>::type = 0> +std::string join(T first, T last, const std::string &separator) +{ + return std::accumulate(std::next(first), last, *first, [&separator](const std::string & base, const std::string & suffix) + { + return base + separator + suffix; + }); +} + +/** Helper function to concatenate multiple values. + * + * All values are converted to std::string using the provided operation before + * being joined. + * + * The signature of op has to be equivalent to + * std::string op(const T::value_type &val). + * + * @param[in] first Iterator pointing to the first element to be concatenated. + * @param[in] last Iterator pointing behind the last element to be concatenated. + * @param[in] separator String used to join the elements. + * @param[in] op Conversion function. + * + * @return String containing all elements joined by @p separator. + */ +template <typename T, typename UnaryOp> +std::string join(T &&first, T &&last, const std::string &separator, UnaryOp &&op) +{ + return std::accumulate(std::next(first), last, op(*first), [&separator, &op](const std::string & base, const typename T::value_type & suffix) + { + return base + separator + op(suffix); + }); +} + +/** Helper function to concatenate multiple values. + * + * All values are converted to std::string using std::to_string before being joined. + * + * @param[in] first Iterator pointing to the first element to be concatenated. + * @param[in] last Iterator pointing behind the last element to be concatenated. + * @param[in] separator String used to join the elements. + * + * @return String containing all elements joined by @p separator. + */ +template <typename T, typename std::enable_if<std::is_arithmetic<typename T::value_type>::value, int>::type = 0> +std::string join(T && first, T && last, const std::string &separator) +{ + return join(std::forward<T>(first), std::forward<T>(last), separator, support::cpp11::to_string); +} + +/** Convert string to lower case. + * + * @param[in] string To be converted string. + * + * @return Lower case string. + */ +inline std::string tolower(std::string string) +{ + std::transform(string.begin(), string.end(), string.begin(), [](unsigned char c) + { + return std::tolower(c); + }); + return string; +} +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_UTILS */ diff --git a/tests/framework/command_line/CommandLineOptions.h b/tests/framework/command_line/CommandLineOptions.h new file mode 100644 index 0000000000..cb4b794a3e --- /dev/null +++ b/tests/framework/command_line/CommandLineOptions.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_COMMANDLINEOPTIONS +#define ARM_COMPUTE_TEST_COMMANDLINEOPTIONS + +#include "EnumListOption.h" +#include "EnumOption.h" +#include "ListOption.h" +#include "Option.h" +#include "ToggleOption.h" + +#endif /* ARM_COMPUTE_TEST_COMMANDLINEOPTIONS */ diff --git a/tests/framework/command_line/CommandLineParser.cpp b/tests/framework/command_line/CommandLineParser.cpp new file mode 100644 index 0000000000..228b18d842 --- /dev/null +++ b/tests/framework/command_line/CommandLineParser.cpp @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "CommandLineParser.h" + +#include <iostream> +#include <regex> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +void CommandLineParser::parse(int argc, char **argv) +{ + const std::regex option_regex{ "--((?:no-)?)([^=]+)(?:=(.*))?" }; + + const auto set_option = [&](const std::string & option, const std::string & name, const std::string & value) + { + if(_options.find(name) == _options.end()) + { + _unknown_options.push_back(option); + return; + } + + const bool success = _options[name]->parse(value); + + if(!success) + { + _invalid_options.push_back(option); + } + }; + + unsigned int positional_index = 0; + + for(int i = 1; i < argc; ++i) + { + const std::string option{ argv[i] }; + std::smatch option_matches; + + if(std::regex_match(option, option_matches, option_regex)) + { + // Boolean option + if(option_matches.str(3).empty()) + { + set_option(option, option_matches.str(2), option_matches.str(1).empty() ? "true" : "false"); + } + else + { + // Can't have "no-" and a value + if(!option_matches.str(1).empty()) + { + _invalid_options.emplace_back(option); + } + else + { + set_option(option, option_matches.str(2), option_matches.str(3)); + } + } + } + else + { + if(positional_index >= _positional_options.size()) + { + _invalid_options.push_back(option); + } + else + { + _positional_options[positional_index]->parse(option); + ++positional_index; + } + } + } +} + +bool CommandLineParser::validate() const +{ + bool is_valid = true; + + for(const auto &option : _options) + { + if(option.second->is_required() && !option.second->is_set()) + { + is_valid = false; + std::cerr << "ERROR: Option '" << option.second->name() << "' is required but not given!\n"; + } + } + + for(const auto &option : _positional_options) + { + if(option->is_required() && !option->is_set()) + { + is_valid = false; + std::cerr << "ERROR: Option '" << option->name() << "' is required but not given!\n"; + } + } + + for(const auto &option : _unknown_options) + { + std::cerr << "WARNING: Skipping unknown option '" << option << "'!\n"; + } + + for(const auto &option : _invalid_options) + { + std::cerr << "WARNING: Skipping invalid option '" << option << "'!\n"; + } + + return is_valid; +} + +void CommandLineParser::print_help(const std::string &program_name) const +{ + std::cout << "usage: " << program_name << " \n"; + + for(const auto &option : _options) + { + std::cout << option.second->help() << "\n"; + } + + for(const auto &option : _positional_options) + { + //FIXME: Print help string as well + std::cout << option->name() << "\n"; + } +} +} // namespace framework +} // namespace test +} // namespace arm_compute diff --git a/tests/framework/command_line/CommandLineParser.h b/tests/framework/command_line/CommandLineParser.h new file mode 100644 index 0000000000..adb5214e2f --- /dev/null +++ b/tests/framework/command_line/CommandLineParser.h @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_COMMANDLINEPARSER +#define ARM_COMPUTE_TEST_COMMANDLINEPARSER + +#include "../Utils.h" +#include "Option.h" + +#include <map> +#include <memory> +#include <string> +#include <utility> +#include <vector> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Class to parse command line arguments. */ +class CommandLineParser final +{ +public: + /** Default constructor. */ + CommandLineParser() = default; + + /** Function to add a new option to the parser. + * + * @param[in] name Name of the option. Will be available under --name=VALUE. + * @param[in] args Option specific configuration arguments. + * + * @return Pointer to the option. The option is owned by the parser. + */ + template <typename T, typename... As> + T *add_option(const std::string &name, As &&... args); + + /** Function to add a new positional argument to the parser. + * + * @param[in] args Option specific configuration arguments. + * + * @return Pointer to the option. The option is owned by the parser. + */ + template <typename T, typename... As> + T *add_positional_option(As &&... args); + + /** Parses the command line arguments and updates the options accordingly. + * + * @param[in] argc Number of arguments. + * @param[in] argv Arguments. + */ + void parse(int argc, char **argv); + + /** Validates the previously parsed command line arguments. + * + * Validation fails if not all required options are provided. Additionally + * warnings are generated for options that have illegal values or unknown + * options. + * + * @return True if all required options have been provided. + */ + bool validate() const; + + /** Prints a help message for all configured options. + * + * @param[in] program_name Name of the program to be used in the help message. + */ + void print_help(const std::string &program_name) const; + +private: + using OptionsMap = std::map<std::string, std::unique_ptr<Option>>; + using PositionalOptionsVector = std::vector<std::unique_ptr<Option>>; + + OptionsMap _options{}; + PositionalOptionsVector _positional_options{}; + std::vector<std::string> _unknown_options{}; + std::vector<std::string> _invalid_options{}; +}; + +template <typename T, typename... As> +inline T *CommandLineParser::add_option(const std::string &name, As &&... args) +{ + auto result = _options.emplace(name, support::cpp14::make_unique<T>(name, std::forward<As>(args)...)); + return static_cast<T *>(result.first->second.get()); +} + +template <typename T, typename... As> +inline T *CommandLineParser::add_positional_option(As &&... args) +{ + _positional_options.emplace_back(support::cpp14::make_unique<T>(std::forward<As>(args)...)); + return static_cast<T *>(_positional_options.back().get()); +} +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_COMMANDLINEPARSER */ diff --git a/tests/framework/command_line/EnumListOption.h b/tests/framework/command_line/EnumListOption.h new file mode 100644 index 0000000000..d19bfbdc0f --- /dev/null +++ b/tests/framework/command_line/EnumListOption.h @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_ENUMLISTOPTION +#define ARM_COMPUTE_TEST_ENUMLISTOPTION + +#include "Option.h" + +#include <initializer_list> +#include <set> +#include <sstream> +#include <stdexcept> +#include <string> +#include <vector> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Implementation of an option that accepts any number of values from a fixed set. */ +template <typename T> +class EnumListOption : public Option +{ +public: + /** Construct option with allowed values. + * + * @param[in] name Name of the option. + * @param[in] allowed_values Set of allowed values for the option. + */ + EnumListOption(std::string name, std::set<T> allowed_values); + + /** Construct option with allowed values, a fixed number of accepted values and default values for the option. + * + * @param[in] name Name of the option. + * @param[in] allowed_values Set of allowed values for the option. + * @param[in] default_values Default values. + */ + EnumListOption(std::string name, std::set<T> allowed_values, std::initializer_list<T> &&default_values); + + bool parse(std::string value) override; + std::string help() const override; + const std::vector<T> &value() const; + +private: + std::vector<T> _values{}; + std::set<T> _allowed_values{}; +}; + +template <typename T> +inline EnumListOption<T>::EnumListOption(std::string name, std::set<T> allowed_values) + : Option{ std::move(name) }, _allowed_values{ std::move(allowed_values) } +{ +} + +template <typename T> +inline EnumListOption<T>::EnumListOption(std::string name, std::set<T> allowed_values, std::initializer_list<T> &&default_values) + : Option{ std::move(name), false, true }, _values{ std::forward<std::initializer_list<T>>(default_values) }, _allowed_values{ std::move(allowed_values) } +{ +} + +template <typename T> +bool EnumListOption<T>::parse(std::string value) +{ + // Remove default values + _values.clear(); + _is_set = true; + + try + { + std::stringstream stream{ value }; + std::string item; + + while(!std::getline(stream, item, ',').fail()) + { + std::stringstream item_stream(item); + T typed_value{}; + + item_stream >> typed_value; + + if(!item_stream.fail()) + { + if(_allowed_values.count(typed_value) == 0) + { + _values.clear(); + return false; + } + + _values.emplace_back(typed_value); + } + + _is_set = _is_set && !item_stream.fail(); + } + + return _is_set; + } + catch(const std::invalid_argument &) + { + return false; + } +} + +template <typename T> +std::string EnumListOption<T>::help() const +{ + std::stringstream msg; + msg << "--" + name() + "={"; + + for(const auto &value : _allowed_values) + { + msg << value << ","; + } + + msg << "}[,{...}[,...]] - " << _help; + + return msg.str(); +} + +template <typename T> +inline const std::vector<T> &EnumListOption<T>::value() const +{ + return _values; +} +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_ENUMLISTOPTION */ diff --git a/tests/framework/command_line/EnumOption.h b/tests/framework/command_line/EnumOption.h new file mode 100644 index 0000000000..1abba77b4b --- /dev/null +++ b/tests/framework/command_line/EnumOption.h @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_ENUMOPTION +#define ARM_COMPUTE_TEST_ENUMOPTION + +#include "SimpleOption.h" + +#include <set> +#include <sstream> +#include <stdexcept> +#include <string> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Implementation of a simple option that accepts a value from a fixed set. */ +template <typename T> +class EnumOption : public SimpleOption<T> +{ +public: + /** Construct option with allowed values. + * + * @param[in] name Name of the option. + * @param[in] allowed_values Set of allowed values for the option. + */ + EnumOption(std::string name, std::set<T> allowed_values); + + /** Construct option with allowed values, a fixed number of accepted values and default values for the option. + * + * @param[in] name Name of the option. + * @param[in] allowed_values Set of allowed values for the option. + * @param[in] default_value Default value. + */ + EnumOption(std::string name, std::set<T> allowed_values, T default_value); + + bool parse(std::string value) override; + std::string help() const override; + const T &value() const; + +private: + std::set<T> _allowed_values{}; +}; + +template <typename T> +inline EnumOption<T>::EnumOption(std::string name, std::set<T> allowed_values) + : SimpleOption<T>{ std::move(name) }, _allowed_values{ std::move(allowed_values) } +{ +} + +template <typename T> +inline EnumOption<T>::EnumOption(std::string name, std::set<T> allowed_values, T default_value) + : SimpleOption<T>{ std::move(name), std::move(default_value) }, _allowed_values{ std::move(allowed_values) } +{ +} + +template <typename T> +bool EnumOption<T>::parse(std::string value) +{ + try + { + std::stringstream stream{ value }; + T typed_value{}; + + stream >> typed_value; + + if(!stream.fail()) + { + if(_allowed_values.count(typed_value) == 0) + { + return false; + } + + this->_value = std::move(typed_value); + this->_is_set = true; + return true; + } + + return false; + } + catch(const std::invalid_argument &) + { + return false; + } +} + +template <typename T> +std::string EnumOption<T>::help() const +{ + std::stringstream msg; + msg << "--" + this->name() + "={"; + + for(const auto &value : _allowed_values) + { + msg << value << ","; + } + + msg << "} - " << this->_help; + + return msg.str(); +} + +template <typename T> +inline const T &EnumOption<T>::value() const +{ + return this->_value; +} +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_ENUMOPTION */ diff --git a/tests/framework/command_line/ListOption.h b/tests/framework/command_line/ListOption.h new file mode 100644 index 0000000000..8b1bb3d05a --- /dev/null +++ b/tests/framework/command_line/ListOption.h @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_LISTOPTION +#define ARM_COMPUTE_TEST_LISTOPTION + +#include "Option.h" + +#include <initializer_list> +#include <sstream> +#include <stdexcept> +#include <string> +#include <vector> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Implementation of an option that accepts any number of values. */ +template <typename T> +class ListOption : public Option +{ +public: + using Option::Option; + + /** Construct the option with the given default values. + * + * @param[in] name Name of the option. + * @param[in] default_values Default values. + */ + ListOption(std::string name, std::initializer_list<T> &&default_values); + + bool parse(std::string value) override; + std::string help() const override; + const std::vector<T> &value() const; + +private: + std::vector<T> _values{}; +}; + +template <typename T> +inline ListOption<T>::ListOption(std::string name, std::initializer_list<T> &&default_values) + : Option{ std::move(name), false, true }, _values{ std::forward<std::initializer_list<T>>(default_values) } +{ +} + +template <typename T> +bool ListOption<T>::parse(std::string value) +{ + _is_set = true; + + try + { + std::stringstream stream{ value }; + std::string item; + + while(!std::getline(stream, item, ',').fail()) + { + std::stringstream item_stream(item); + T typed_value{}; + + item_stream >> typed_value; + + if(!item_stream.fail()) + { + _values.emplace_back(typed_value); + } + + _is_set = _is_set && !item_stream.fail(); + } + + return _is_set; + } + catch(const std::invalid_argument &) + { + return false; + } +} + +template <typename T> +inline std::string ListOption<T>::help() const +{ + return "--" + name() + "=VALUE[,VALUE[,...]] - " + _help; +} + +template <typename T> +inline const std::vector<T> &ListOption<T>::value() const +{ + return _values; +} +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_LISTOPTION */ diff --git a/tests/framework/command_line/Option.cpp b/tests/framework/command_line/Option.cpp new file mode 100644 index 0000000000..d60c35a698 --- /dev/null +++ b/tests/framework/command_line/Option.cpp @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "Option.h" + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +Option::Option(std::string name) + : _name{ std::move(name) } +{ +} + +Option::Option(std::string name, bool is_required, bool is_set) + : _name{ std::move(name) }, _is_required{ is_required }, _is_set{ is_set } +{ +} + +std::string Option::name() const +{ + return _name; +} + +void Option::set_required(bool is_required) +{ + _is_required = is_required; +} + +void Option::set_help(std::string help) +{ + _help = std::move(help); +} + +bool Option::is_required() const +{ + return _is_required; +} + +bool Option::is_set() const +{ + return _is_set; +} +} // namespace framework +} // namespace test +} // namespace arm_compute diff --git a/tests/framework/command_line/Option.h b/tests/framework/command_line/Option.h new file mode 100644 index 0000000000..25cf492b86 --- /dev/null +++ b/tests/framework/command_line/Option.h @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_OPTIONBASE +#define ARM_COMPUTE_TEST_OPTIONBASE + +#include <string> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Abstract base class for a command line option. */ +class Option +{ +public: + /** Constructor. + * + * @param[in] name Name of the option. + */ + Option(std::string name); + + /** Constructor. + * + * @param[in] name Name of the option. + * @param[in] is_required Is the option required? + * @param[in] is_set Has a value been assigned to the option? + */ + Option(std::string name, bool is_required, bool is_set); + + /** Default destructor. */ + virtual ~Option() = default; + + /** Parses the given string. + * + * @param[in] value String representation as passed on the command line. + * + * @return True if the value could be parsed by the specific subclass. + */ + virtual bool parse(std::string value) = 0; + + /** Help message for the option. + * + * @return String representing the help message for the specific subclass. + */ + virtual std::string help() const = 0; + + /** Name of the option. + * + * @return Name of the option. + */ + std::string name() const; + + /** Set whether the option is required. + * + * @param[in] is_required Pass true if the option is required. + */ + void set_required(bool is_required); + + /** Set the help message for the option. + * + * @param[in] help Option specific help message. + */ + void set_help(std::string help); + + /** Is the option required? + * + * @return True if the option is required. + */ + bool is_required() const; + + /** Has a value been assigned to the option? + * + * @return True if a value has been set. + */ + bool is_set() const; + +protected: + std::string _name; + bool _is_required{ false }; + bool _is_set{ false }; + std::string _help{}; +}; +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_OPTIONBASE */ diff --git a/tests/framework/command_line/SimpleOption.h b/tests/framework/command_line/SimpleOption.h new file mode 100644 index 0000000000..e6e8045840 --- /dev/null +++ b/tests/framework/command_line/SimpleOption.h @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_SIMPLEOPTION +#define ARM_COMPUTE_TEST_SIMPLEOPTION + +#include "Option.h" + +#include <sstream> +#include <stdexcept> +#include <string> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Implementation of an option that accepts a single value. */ +template <typename T> +class SimpleOption : public Option +{ +public: + using Option::Option; + + /** Construct the option with the given default value. + * + * @param[in] name Name of the option. + * @param[in] default_value Default value. + */ + SimpleOption(std::string name, T default_value); + + bool parse(std::string value) override; + std::string help() const override; + const T &value() const; + +protected: + T _value{}; +}; + +template <typename T> +inline SimpleOption<T>::SimpleOption(std::string name, T default_value) + : Option{ std::move(name), false, true }, _value{ std::move(default_value) } +{ +} + +template <typename T> +bool SimpleOption<T>::parse(std::string value) +{ + try + { + std::stringstream stream{ std::move(value) }; + stream >> _value; + _is_set = !stream.fail(); + return _is_set; + } + catch(const std::invalid_argument &) + { + return false; + } +} + +template <> +inline bool SimpleOption<std::string>::parse(std::string value) +{ + _value = std::move(value); + _is_set = true; + return true; +} + +template <typename T> +inline std::string SimpleOption<T>::help() const +{ + return "--" + name() + "=VALUE - " + _help; +} + +template <typename T> +inline const T &SimpleOption<T>::value() const +{ + return _value; +} +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_SIMPLEOPTION */ diff --git a/tests/framework/command_line/ToggleOption.cpp b/tests/framework/command_line/ToggleOption.cpp new file mode 100644 index 0000000000..df5b1f813b --- /dev/null +++ b/tests/framework/command_line/ToggleOption.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "ToggleOption.h" + +#include <utility> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +ToggleOption::ToggleOption(std::string name, bool default_value) + : SimpleOption<bool> +{ + std::move(name), default_value +} +{ +} + +bool ToggleOption::parse(std::string value) +{ + if(value == "true") + { + _value = true; + _is_set = true; + } + else if(value == "false") + { + _value = false; + _is_set = true; + } + + return _is_set; +} + +std::string ToggleOption::help() const +{ + return "--" + name() + ", --no-" + name() + " - " + _help; +} +} // namespace framework +} // namespace test +} // namespace arm_compute diff --git a/tests/framework/command_line/ToggleOption.h b/tests/framework/command_line/ToggleOption.h new file mode 100644 index 0000000000..c440c0ee87 --- /dev/null +++ b/tests/framework/command_line/ToggleOption.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_TOGGLEOPTION +#define ARM_COMPUTE_TEST_TOGGLEOPTION + +#include "SimpleOption.h" + +#include <string> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Implementation of an option that can be either true or false. */ +class ToggleOption : public SimpleOption<bool> +{ +public: + using SimpleOption::SimpleOption; + + /** Construct the option with the given default value. + * + * @param[in] name Name of the option. + * @param[in] default_value Default value. + */ + ToggleOption(std::string name, bool default_value); + + bool parse(std::string value) override; + std::string help() const override; +}; +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_TOGGLEOPTION */ diff --git a/tests/framework/datasets/CartesianProductDataset.h b/tests/framework/datasets/CartesianProductDataset.h new file mode 100644 index 0000000000..f6e45ddc12 --- /dev/null +++ b/tests/framework/datasets/CartesianProductDataset.h @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_DATASET_CARTESIAN_PRODUCT +#define ARM_COMPUTE_TEST_DATASET_CARTESIAN_PRODUCT + +#include "Dataset.h" + +#include <string> +#include <tuple> +#include <utility> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +namespace dataset +{ +/** Implementation of a dataset representing all combinations of values of the input datasets. + * + * For example, for the inputs {1, 2} and {3, 4} this dataset virtually + * represents the values {(1, 3), (1, 4), (2, 3), (2, 4)}. + */ +template <typename T, typename U> +class CartesianProductDataset : public Dataset +{ +private: + using T_noref = typename std::remove_reference<T>::type; + using U_noref = typename std::remove_reference<U>::type; + using iter1_type = typename T_noref::iterator; + using iter2_type = typename U_noref::iterator; + +public: + /** Construct dataset from the given datasets. + * + * @param[in] dataset1 First dataset. + * @param[in] dataset2 Second dataset. + */ + CartesianProductDataset(T &&dataset1, U &&dataset2) + : _dataset1{ std::forward<T>(dataset1) }, + _dataset2{ std::forward<U>(dataset2) } + { + } + + CartesianProductDataset(CartesianProductDataset &&) = default; + + /** Type of the dataset. */ + using type = decltype(std::tuple_cat(*std::declval<iter1_type>(), *std::declval<iter2_type>())); + + /** Iterator for the dataset. */ + struct iterator + { + iterator(const T_noref *dataset1, const U_noref *dataset2) + : _iter1{ dataset1->begin() }, + _dataset2{ dataset2 }, + _iter2{ dataset2->begin() } + { + } + + iterator(const iterator &) = default; + iterator &operator=(const iterator &) = default; + iterator(iterator &&) = default; + iterator &operator=(iterator &&) = default; + + ~iterator() = default; + + std::string description() const + { + return _iter1.description() + ":" + _iter2.description(); + } + + CartesianProductDataset::type operator*() const + { + return std::tuple_cat(*_iter1, *_iter2); + } + + iterator &operator++() + { + ++_second_pos; + + if(_second_pos < _dataset2->size()) + { + ++_iter2; + } + else + { + _second_pos = 0; + _iter2 = _dataset2->begin(); + + ++_iter1; + } + + return *this; + } + + private: + iter1_type _iter1; + const U_noref *_dataset2; + iter2_type _iter2; + int _first_pos{ 0 }; + int _second_pos{ 0 }; + }; + + /** Iterator pointing at the begin of the dataset. + * + * @return Iterator for the dataset. + */ + iterator begin() const + { + return iterator(&_dataset1, &_dataset2); + } + + /** Size of the dataset. + * + * @return Number of values in the dataset. + */ + int size() const + { + return _dataset1.size() * _dataset2.size(); + } + +private: + T _dataset1; + U _dataset2; +}; + +/** Helper function to create a @ref CartesianProductDataset. + * + * @param[in] dataset1 First dataset. + * @param[in] dataset2 Second dataset. + * + * @return A grid dataset. + */ +template <typename T, typename U> +CartesianProductDataset<T, U> combine(T &&dataset1, U &&dataset2) +{ + return CartesianProductDataset<T, U>(std::forward<T>(dataset1), std::forward<U>(dataset2)); +} +} // namespace dataset +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_DATASET_CARTESIAN_PRODUCT */ diff --git a/tests/framework/datasets/ContainerDataset.h b/tests/framework/datasets/ContainerDataset.h new file mode 100644 index 0000000000..bdca97cbac --- /dev/null +++ b/tests/framework/datasets/ContainerDataset.h @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_DATASET_CONTAINER +#define ARM_COMPUTE_TEST_DATASET_CONTAINER + +#include "Dataset.h" +#include "support/ToolchainSupport.h" + +#include <string> +#include <tuple> +#include <type_traits> +#include <utility> +#include <vector> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +namespace dataset +{ +/** Base case. Nothing is a container. */ +template <typename T> +struct is_container : public std::false_type +{ +}; + +/** Vector is considered a container. */ +template <typename V, typename A> +struct is_container<std::vector<V, A>> : public std::true_type +{ +}; + +/** Implementation of a dataset created from a container. */ +template <typename T> +class ContainerDataset : public NamedDataset +{ +private: + using container_value_type = typename T::value_type; + using container_const_iterator = typename T::const_iterator; + +public: + /** Construct dataset with given name and values from the container. + * + * @param[in] name Description of the values. + * @param[in] container Values for the dataset. + */ + ContainerDataset(std::string name, T &&container) + : NamedDataset{ std::move(name) }, _container(std::forward<T>(container)) + { + } + + ContainerDataset(ContainerDataset &&) = default; + + /** Type of the dataset. */ + using type = std::tuple<container_value_type>; + + /** Iterator for the dataset. */ + struct iterator + { + iterator(std::string name, container_const_iterator iterator) + : _name{ name }, _iterator{ iterator } + { + } + + std::string description() const + { + using support::cpp11::to_string; + return _name + "=" + to_string(*_iterator); + } + + ContainerDataset::type operator*() const + { + return std::make_tuple(*_iterator); + } + + iterator &operator++() + { + ++_iterator; + return *this; + } + + private: + std::string _name; + container_const_iterator _iterator; + }; + + /** Iterator pointing at the begin of the dataset. + * + * @return Iterator for the dataset. + */ + iterator begin() const + { + return iterator(name(), _container.cbegin()); + } + + /** Size of the dataset. + * + * @return Number of values in the dataset. + */ + int size() const + { + return _container.size(); + } + +private: + T _container; +}; + +/** Helper function to create a @ref ContainerDataset. + * + * @param[in] name Name of the dataset. + * @param[in] values Container. + * + * @return A container dataset. + */ +template <typename T> +typename std::enable_if<is_container<T>::value, ContainerDataset<T>>::type make(std::string name, T &&values) +{ + return ContainerDataset<T>(std::move(name), std::forward<T>(values)); +} +} // namespace dataset +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_DATASET_CONTAINER */ diff --git a/tests/framework/datasets/Dataset.h b/tests/framework/datasets/Dataset.h new file mode 100644 index 0000000000..d91673073a --- /dev/null +++ b/tests/framework/datasets/Dataset.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_DATASET +#define ARM_COMPUTE_TEST_DATASET + +#include <string> +#include <utility> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +namespace dataset +{ +/** Abstract dataset base class. */ +class Dataset +{ +protected: + Dataset() = default; + ~Dataset() = default; + +public: + Dataset(Dataset &&) = default; +}; + +/** Abstract implementation of a named dataset. + * + * The name should describe the values of the dataset. + */ +class NamedDataset : public Dataset +{ +protected: + /** Construct the dataset with the given name. + * + * @param[in] name Description of the values. + */ + explicit NamedDataset(std::string name) + : _name{ std::move(name) } + { + } + + ~NamedDataset() = default; + +public: + NamedDataset(NamedDataset &&) = default; + + /** Return name of the dataset. + * + * @return Description of the values. + */ + std::string name() const + { + return _name; + } + +protected: + const std::string _name; +}; +} // namespace dataset +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_DATASET */ diff --git a/tests/framework/datasets/Datasets.h b/tests/framework/datasets/Datasets.h new file mode 100644 index 0000000000..c0e5822e17 --- /dev/null +++ b/tests/framework/datasets/Datasets.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_DATASETS +#define ARM_COMPUTE_TEST_DATASETS + +#include "CartesianProductDataset.h" +#include "ContainerDataset.h" +#include "InitializerListDataset.h" +#include "JoinDataset.h" +#include "RangeDataset.h" +#include "SingletonDataset.h" +#include "ZipDataset.h" + +#endif /* ARM_COMPUTE_TEST_DATASETS */ diff --git a/tests/framework/datasets/InitializerListDataset.h b/tests/framework/datasets/InitializerListDataset.h new file mode 100644 index 0000000000..7d32234fab --- /dev/null +++ b/tests/framework/datasets/InitializerListDataset.h @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_DATASET_LIST +#define ARM_COMPUTE_TEST_DATASET_LIST + +#include "Dataset.h" +#include "support/ToolchainSupport.h" + +#include <initializer_list> +#include <string> +#include <tuple> +#include <utility> +#include <vector> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +namespace dataset +{ +/** Implementation of a dataset created from an initializer list. */ +template <typename T> +class InitializerListDataset final : public NamedDataset +{ +private: + using data_const_iterator = typename std::vector<T>::const_iterator; + +public: + /** Construct dataset with given name and values from the container. + * + * @param[in] name Description of the values. + * @param[in] list Values for the dataset. + */ + InitializerListDataset(std::string name, std::initializer_list<T> &&list) + : NamedDataset{ std::move(name) }, _data(std::forward<std::initializer_list<T>>(list)) + { + } + + InitializerListDataset(InitializerListDataset &&) = default; + + /** Type of the dataset. */ + using type = std::tuple<T>; + + /** Iterator for the dataset. */ + struct iterator + { + iterator(std::string name, data_const_iterator iterator) + : _name{ name }, _iterator{ iterator } + { + } + + std::string description() const + { + using support::cpp11::to_string; + return _name + "=" + to_string(*_iterator); + } + + InitializerListDataset::type operator*() const + { + return std::make_tuple(*_iterator); + } + + iterator &operator++() + { + ++_iterator; + return *this; + } + + private: + std::string _name; + data_const_iterator _iterator; + }; + + /** Iterator pointing at the begin of the dataset. + * + * @return Iterator for the dataset. + */ + iterator begin() const + { + return iterator(name(), _data.cbegin()); + } + + /** Size of the dataset. + * + * @return Number of values in the dataset. + */ + int size() const + { + return _data.size(); + } + +private: + std::vector<T> _data; +}; + +/** Helper function to create an @ref InitializerListDataset. + * + * @param[in] name Name of the dataset. + * @param[in] list Initializer list. + * + * @return An initializer list dataset. + */ +template <typename T> +InitializerListDataset<T> make(std::string name, std::initializer_list<T> &&list) +{ + return InitializerListDataset<T>(std::move(name), std::forward<std::initializer_list<T>>(list)); +} +} // namespace dataset +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_DATASET_LIST */ diff --git a/tests/framework/datasets/JoinDataset.h b/tests/framework/datasets/JoinDataset.h new file mode 100644 index 0000000000..eded6e0259 --- /dev/null +++ b/tests/framework/datasets/JoinDataset.h @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_DATASET_JOIN +#define ARM_COMPUTE_TEST_DATASET_JOIN + +#include "Dataset.h" + +#include <string> +#include <tuple> +#include <utility> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +namespace dataset +{ +/** Implementation of a dataset representing the concatenation of the input datasets. + * + * For example, for the inputs {1, 2} and {3, 4} this dataset virtually + * represents the values {1, 2, 3, 4}. + */ +template <typename T, typename U> +class JoinDataset : public Dataset +{ +private: + using iter1_type = typename T::iterator; + using iter2_type = typename U::iterator; + +public: + /** Construct dataset from the given datasets. + * + * @param[in] dataset1 First dataset. + * @param[in] dataset2 Second dataset. + */ + JoinDataset(T &&dataset1, U &&dataset2) + : _dataset1{ std::forward<T>(dataset1) }, + _dataset2{ std::forward<U>(dataset2) } + { + } + + JoinDataset(JoinDataset &&) = default; + + /** Type of the dataset. */ + using type = typename T::type; + + /** Iterator for the dataset. */ + struct iterator + { + iterator(const T *dataset1, const U *dataset2) + : _iter1{ dataset1->begin() }, _iter2{ dataset2->begin() }, _first_size{ dataset1->size() } + { + } + + std::string description() const + { + return _first_size > 0 ? _iter1.description() : _iter2.description(); + } + + JoinDataset::type operator*() const + { + return _first_size > 0 ? *_iter1 : *_iter2; + } + + iterator &operator++() + { + if(_first_size > 0) + { + --_first_size; + ++_iter1; + } + else + { + ++_iter2; + } + + return *this; + } + + private: + iter1_type _iter1; + iter2_type _iter2; + int _first_size; + }; + + /** Iterator pointing at the begin of the dataset. + * + * @return Iterator for the dataset. + */ + iterator begin() const + { + return iterator(&_dataset1, &_dataset2); + } + + /** Size of the dataset. + * + * @return Number of values in the dataset. + */ + int size() const + { + return _dataset1.size() + _dataset2.size(); + } + +private: + T _dataset1; + U _dataset2; +}; + +/** Helper function to create a @ref JoinDataset. + * + * @param[in] dataset1 First dataset. + * @param[in] dataset2 Second dataset. + * + * @return A join dataset. + */ +template <typename T, typename U> +JoinDataset<T, U> concat(T &&dataset1, U &&dataset2) +{ + return JoinDataset<T, U>(std::forward<T>(dataset1), std::forward<U>(dataset2)); +} +} // namespace dataset +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_DATASET_JOIN */ diff --git a/tests/framework/datasets/RangeDataset.h b/tests/framework/datasets/RangeDataset.h new file mode 100644 index 0000000000..637abe0a83 --- /dev/null +++ b/tests/framework/datasets/RangeDataset.h @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_DATASET_RANGE +#define ARM_COMPUTE_TEST_DATASET_RANGE + +#include "Dataset.h" +#include "support/ToolchainSupport.h" + +#include <string> +#include <tuple> +#include <type_traits> +#include <utility> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +namespace dataset +{ +/** Implementation of a dataset created from a range of values. + * + * The range is inclusive of the first value but exclusive of the last, i.e. [start, end). + */ +template <typename T> +class RangeDataset final : public NamedDataset +{ +public: + /** Construct dataset with given name and values in the specified range. + * + * @param[in] name Description of the values. + * @param[in] start Begin of the range. + * @param[in] end End of the range. + * @param[in] step Step size. + */ + RangeDataset(std::string name, T start, T end, T step = 1) + : NamedDataset{ std::move(name) }, _start{ start }, _end{ end }, _step{ step } + { + } + + RangeDataset(RangeDataset &&) = default; + + /** Type of the dataset. */ + using type = std::tuple<T>; + + /** Iterator for the dataset. */ + struct iterator + { + iterator(std::string name, T start, T step) + : _name{ name }, _value{ start }, _step{ step } + { + } + + std::string description() const + { + using support::cpp11::to_string; + return _name + "=" + to_string(_value); + } + + RangeDataset::type operator*() const + { + return std::make_tuple(_value); + } + + iterator &operator++() + { + _value += _step; + return *this; + } + + private: + std::string _name; + T _value; + T _step; + }; + + /** Iterator pointing at the begin of the dataset. + * + * @return Iterator for the dataset. + */ + iterator begin() const + { + return iterator(name(), _start, _step); + } + + /** Size of the dataset. + * + * @return Number of values in the dataset. + */ + int size() const + { + return (_end - _start) / std::abs(_step); + } + +private: + T _start; + T _end; + T _step; +}; + +/** Helper function to create a @ref RangeDataset. + * + * @param[in] name Name of the dataset. + * @param[in] start Begin of the range. + * @param[in] end End of the range. + * @param[in] step Step size. + * + * @return A range dataset. + */ +template <typename T> +RangeDataset<T> make(std::string name, T start, T end, T step = 1) +{ + return RangeDataset<T>(std::move(name), start, end, step); +} +} // namespace dataset +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_DATASET_RANGE */ diff --git a/tests/framework/datasets/SingletonDataset.h b/tests/framework/datasets/SingletonDataset.h new file mode 100644 index 0000000000..1acb5765e5 --- /dev/null +++ b/tests/framework/datasets/SingletonDataset.h @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_DATASET_SINGLETON +#define ARM_COMPUTE_TEST_DATASET_SINGLETON + +#include "ContainerDataset.h" +#include "Dataset.h" +#include "support/ToolchainSupport.h" + +#include <string> +#include <tuple> +#include <type_traits> +#include <utility> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +namespace dataset +{ +/** Implementation of a dataset holding a single value. */ +template <typename T> +class SingletonDataset : public NamedDataset +{ +public: + /** Construct dataset with given name and value. + * + * @param[in] name Description of the value. + * @param[in] value Value for the dataset. + */ + SingletonDataset(std::string name, T &&value) + : NamedDataset{ std::move(name) }, _value{ std::forward<T>(value) } + { + } + + SingletonDataset(SingletonDataset &&) = default; + + /** Type of the dataset. */ + using type = std::tuple<T>; + + /** Iterator for the dataset. */ + struct iterator + { + iterator(std::string name, const T *value) + : _name{ name }, _value{ value } + { + } + + ~iterator() = default; + + iterator(const iterator &) = default; + iterator &operator=(const iterator &) = default; + iterator(iterator &&) = default; + iterator &operator=(iterator &&) = default; + + std::string description() const + { + using support::cpp11::to_string; + return _name + "=" + to_string(*_value); + } + + SingletonDataset::type operator*() const + { + return std::make_tuple(*_value); + } + + iterator &operator++() + { + return *this; + } + + private: + std::string _name; + const T *_value; + }; + + /** Iterator pointing at the begin of the dataset. + * + * @return Iterator for the dataset. + */ + iterator begin() const + { + return iterator(name(), &_value); + } + + /** Size of the dataset. + * + * @return Number of values in the dataset. + */ + int size() const + { + return 1; + } + +private: + T _value; +}; + +/** Helper function to create a @ref SingletonDataset. + * + * @param[in] name Name of the dataset. + * @param[in] value Value. + * + * @return A singleton dataset. + */ +template <typename T> +typename std::enable_if < !is_container<T>::value, SingletonDataset<T >>::type make(std::string name, T &&value) +{ + return SingletonDataset<T>(std::move(name), std::forward<T>(value)); +} +} // namespace dataset +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_DATASET_SINGLETON */ diff --git a/tests/framework/datasets/ZipDataset.h b/tests/framework/datasets/ZipDataset.h new file mode 100644 index 0000000000..b95b7209a7 --- /dev/null +++ b/tests/framework/datasets/ZipDataset.h @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_DATASET_ZIP +#define ARM_COMPUTE_TEST_DATASET_ZIP + +#include "Dataset.h" + +#include <string> +#include <tuple> +#include <utility> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +namespace dataset +{ +/** Implementation of a dataset representing pairs of values of the input datasets. + * + * For example, for the inputs {1, 2} and {3, 4} this dataset virtually + * represents the values {(1, 3), (1, 4)}. + */ +template <typename T, typename U> +class ZipDataset : public Dataset +{ +private: + using iter1_type = typename T::iterator; + using iter2_type = typename U::iterator; + +public: + /** Construct dataset from the given datasets. + * + * @param[in] dataset1 First dataset. + * @param[in] dataset2 Second dataset. + */ + ZipDataset(T &&dataset1, U &&dataset2) + : _dataset1{ std::forward<T>(dataset1) }, + _dataset2{ std::forward<U>(dataset2) } + { + } + + ZipDataset(ZipDataset &&) = default; + + /** Type of the dataset. */ + using type = decltype(std::tuple_cat(*std::declval<iter1_type>(), *std::declval<iter2_type>())); + + /** Iterator for the dataset. */ + struct iterator + { + iterator(iter1_type iter1, iter2_type iter2) + : _iter1{ std::move(iter1) }, _iter2{ std::move(iter2) } + { + } + + std::string description() const + { + return _iter1.description() + ":" + _iter2.description(); + } + + ZipDataset::type operator*() const + { + return std::tuple_cat(*_iter1, *_iter2); + } + + iterator &operator++() + { + ++_iter1; + ++_iter2; + return *this; + } + + private: + iter1_type _iter1; + iter2_type _iter2; + }; + + /** Iterator pointing at the begin of the dataset. + * + * @return Iterator for the dataset. + */ + iterator begin() const + { + return iterator(_dataset1.begin(), _dataset2.begin()); + } + + /** Size of the dataset. + * + * @return Number of values in the dataset. + */ + int size() const + { + return std::min(_dataset1.size(), _dataset2.size()); + } + +private: + T _dataset1; + U _dataset2; +}; + +/** Helper function to create a @ref ZipDataset. + * + * @param[in] dataset1 First dataset. + * @param[in] dataset2 Second dataset. + * + * @return A zip dataset. + */ +template <typename T, typename U> +ZipDataset<T, U> zip(T &&dataset1, U &&dataset2) +{ + return ZipDataset<T, U>(std::forward<T>(dataset1), std::forward<U>(dataset2)); +} +} // namespace dataset +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_DATASET_ZIP */ diff --git a/tests/framework/instruments/Instrument.h b/tests/framework/instruments/Instrument.h new file mode 100644 index 0000000000..895a64738c --- /dev/null +++ b/tests/framework/instruments/Instrument.h @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_INSTRUMENT +#define ARM_COMPUTE_TEST_INSTRUMENT + +#include "../Utils.h" + +#include <memory> +#include <ostream> +#include <string> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Interface for classes that can be used to measure performance. */ +class Instrument +{ +public: + /** Helper function to create an instrument of the given type. + * + * @return Instance of an instrument of the given type. + */ + template <typename T> + static std::unique_ptr<Instrument> make_instrument(); + + /** Struct representing measurement consisting of value and unit. */ + struct Measurement final + { + Measurement(double value, std::string unit) + : value{ value }, unit{ std::move(unit) } + { + } + + friend std::ostream &operator<<(std::ostream &os, const Measurement &measurement); + + double value; + std::string unit; + }; + + Instrument() = default; + Instrument(const Instrument &) = default; + Instrument(Instrument &&) = default; + Instrument &operator=(const Instrument &) = default; + Instrument &operator=(Instrument &&) = default; + virtual ~Instrument() = default; + + /** Identifier for the instrument */ + virtual std::string id() const = 0; + + /** Start measuring. */ + virtual void start() = 0; + + /** Stop measuring. */ + virtual void stop() = 0; + + /** Return the latest measurement. */ + virtual Measurement measurement() const = 0; +}; + +inline std::ostream &operator<<(std::ostream &os, const Instrument::Measurement &measurement) +{ + os << measurement.value << measurement.unit; + return os; +} + +template <typename T> +inline std::unique_ptr<Instrument> Instrument::make_instrument() +{ + return support::cpp14::make_unique<T>(); +} +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_INSTRUMENT */ diff --git a/tests/framework/instruments/Instruments.cpp b/tests/framework/instruments/Instruments.cpp new file mode 100644 index 0000000000..797a7242ae --- /dev/null +++ b/tests/framework/instruments/Instruments.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "Instruments.h" + +#include "../Utils.h" + +#include <map> +#include <stdexcept> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +InstrumentType instrument_type_from_name(const std::string &name) +{ + static const std::map<std::string, InstrumentType> types = + { + { "all", InstrumentType::ALL }, + { "none", InstrumentType::NONE }, + { "wall_clock", InstrumentType::WALL_CLOCK_TIMER }, + { "cycles", InstrumentType::PMU_CYCLE_COUNTER }, + { "instructions", InstrumentType::PMU_INSTRUCTION_COUNTER }, + }; + + try + { + return types.at(tolower(name)); + } + catch(const std::out_of_range &) + { + throw std::invalid_argument(name); + } +} +} // namespace framework +} // namespace test +} // namespace arm_compute diff --git a/tests/framework/instruments/Instruments.h b/tests/framework/instruments/Instruments.h new file mode 100644 index 0000000000..034fa168f5 --- /dev/null +++ b/tests/framework/instruments/Instruments.h @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_INSTRUMENTS +#define ARM_COMPUTE_TEST_INSTRUMENTS + +#include "PMUCounter.h" +#include "WallClockTimer.h" + +#include <sstream> +#include <string> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +enum class InstrumentType : unsigned int +{ + ALL = ~0U, + NONE = 0, + WALL_CLOCK_TIMER = 1, + PMU_CYCLE_COUNTER = 2, + PMU_INSTRUCTION_COUNTER = 4 +}; + +InstrumentType instrument_type_from_name(const std::string &name); + +inline InstrumentType operator&(InstrumentType t1, InstrumentType t2) +{ + using type = std::underlying_type<InstrumentType>::type; + return static_cast<InstrumentType>(static_cast<type>(t1) & static_cast<type>(t2)); +} + +inline InstrumentType operator|(InstrumentType t1, InstrumentType t2) +{ + using type = std::underlying_type<InstrumentType>::type; + return static_cast<InstrumentType>(static_cast<type>(t1) | static_cast<type>(t2)); +} + +inline InstrumentType &operator|=(InstrumentType &t1, InstrumentType t2) +{ + using type = std::underlying_type<InstrumentType>::type; + t1 = static_cast<InstrumentType>(static_cast<type>(t1) | static_cast<type>(t2)); + return t1; +} + +inline ::std::stringstream &operator>>(::std::stringstream &stream, InstrumentType &instrument) +{ + std::string value; + stream >> value; + instrument = instrument_type_from_name(value); + return stream; +} + +inline ::std::stringstream &operator<<(::std::stringstream &stream, InstrumentType instrument) +{ + switch(instrument) + { + case InstrumentType::WALL_CLOCK_TIMER: + stream << "WALL_CLOCK_TIMER"; + break; + case InstrumentType::PMU_CYCLE_COUNTER: + stream << "PMU_CYCLE_COUNTER"; + break; + case InstrumentType::PMU_INSTRUCTION_COUNTER: + stream << "PMU_INSTRUCTION_COUNTER"; + break; + case InstrumentType::ALL: + stream << "ALL"; + break; + case InstrumentType::NONE: + stream << "NONE"; + break; + default: + throw std::invalid_argument("Unsupported instrument type"); + } + + return stream; +} +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_INSTRUMENTS */ diff --git a/tests/framework/instruments/PMUCounter.cpp b/tests/framework/instruments/PMUCounter.cpp new file mode 100644 index 0000000000..7994a15862 --- /dev/null +++ b/tests/framework/instruments/PMUCounter.cpp @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "PMUCounter.h" + +#define _GNU_SOURCE 1 +#include <asm/unistd.h> +#include <csignal> +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <fcntl.h> +#include <linux/hw_breakpoint.h> +#include <linux/perf_event.h> +#include <sys/ioctl.h> +#include <unistd.h> +#undef _GNU_SOURCE + +#include <stdexcept> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +CycleCounter::CycleCounter() +{ + const pid_t pid = getpid(); + + struct perf_event_attr perf_config; //NOLINT + memset(&perf_config, 0, sizeof(struct perf_event_attr)); + + perf_config.config = PERF_COUNT_HW_CPU_CYCLES; + perf_config.size = sizeof(struct perf_event_attr); + perf_config.type = PERF_TYPE_HARDWARE; + // The inherit bit specifies that this counter should count events of child + // tasks as well as the task specified + perf_config.inherit = 1; + // Enables saving of event counts on context switch for inherited tasks + perf_config.inherit_stat = 1; + + _fd = syscall(__NR_perf_event_open, &perf_config, pid, -1, -1, 0); + + if(_fd < 0) + { + throw std::runtime_error("perf_event_open for cycles failed"); + } +} + +std::string CycleCounter::id() const +{ + return "Cycle Counter"; +} + +void CycleCounter::start() +{ + ioctl(_fd, PERF_EVENT_IOC_RESET, 0); + ioctl(_fd, PERF_EVENT_IOC_ENABLE, 0); +} + +void CycleCounter::stop() +{ + ioctl(_fd, PERF_EVENT_IOC_DISABLE, 0); + read(_fd, &_cycles, sizeof(_cycles)); +} + +Instrument::Measurement CycleCounter::measurement() const +{ + return Measurement(_cycles, "cycles"); +} + +InstructionCounter::InstructionCounter() +{ + const pid_t pid = getpid(); + + struct perf_event_attr perf_config; //NOLINT + memset(&perf_config, 0, sizeof(struct perf_event_attr)); + + perf_config.config = PERF_COUNT_HW_INSTRUCTIONS; + perf_config.size = sizeof(struct perf_event_attr); + perf_config.type = PERF_TYPE_HARDWARE; + // The inherit bit specifies that this counter should count events of child + // tasks as well as the task specified + perf_config.inherit = 1; + // Enables saving of event counts on context switch for inherited tasks + perf_config.inherit_stat = 1; + + _fd = syscall(__NR_perf_event_open, &perf_config, pid, -1, -1, 0); + + if(_fd < 0) + { + throw std::runtime_error("perf_event_open for instructions failed"); + } +} + +std::string InstructionCounter::id() const +{ + return "Instruction Counter"; +} + +void InstructionCounter::start() +{ + ioctl(_fd, PERF_EVENT_IOC_RESET, 0); + ioctl(_fd, PERF_EVENT_IOC_ENABLE, 0); +} + +void InstructionCounter::stop() +{ + ioctl(_fd, PERF_EVENT_IOC_DISABLE, 0); + read(_fd, &_instructions, sizeof(_instructions)); +} + +Instrument::Measurement InstructionCounter::measurement() const +{ + return Measurement(_instructions, "instructions"); +} +} // namespace framework +} // namespace test +} // namespace arm_compute diff --git a/tests/framework/instruments/PMUCounter.h b/tests/framework/instruments/PMUCounter.h new file mode 100644 index 0000000000..f407be602f --- /dev/null +++ b/tests/framework/instruments/PMUCounter.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_PMU_COUNTER +#define ARM_COMPUTE_TEST_PMU_COUNTER + +#include "Instrument.h" + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Implementation of an instrument to count CPU cycles. */ +class CycleCounter : public Instrument +{ +public: + /** Initialise the cycle counter. */ + CycleCounter(); + + std::string id() const override; + void start() override; + void stop() override; + Measurement measurement() const override; + +private: + long _fd{ -1 }; + long long _cycles{ 0 }; +}; + +/** Implementation of an instrument to count executed CPU instructions. */ +class InstructionCounter : public Instrument +{ +public: + /** Initialise the instruction counter. */ + InstructionCounter(); + + std::string id() const override; + void start() override; + void stop() override; + Measurement measurement() const override; + +private: + long _fd{ -1 }; + long long _instructions{ 0 }; +}; +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_PMU_COUNTER */ diff --git a/tests/framework/instruments/WallClockTimer.cpp b/tests/framework/instruments/WallClockTimer.cpp new file mode 100644 index 0000000000..37db0c7f05 --- /dev/null +++ b/tests/framework/instruments/WallClockTimer.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "WallClockTimer.h" + +#include "../Framework.h" +#include "../Utils.h" + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +std::string WallClockTimer::id() const +{ + return "Wall clock"; +} + +void WallClockTimer::start() +{ + _start = std::chrono::high_resolution_clock::now(); +} + +void WallClockTimer::stop() +{ + _stop = std::chrono::high_resolution_clock::now(); +} + +Instrument::Measurement WallClockTimer::measurement() const +{ + const auto delta = std::chrono::duration_cast<std::chrono::microseconds>(_stop - _start); + return Instrument::Measurement(delta.count(), "us"); +} +} // namespace framework +} // namespace test +} // namespace arm_compute diff --git a/tests/framework/instruments/WallClockTimer.h b/tests/framework/instruments/WallClockTimer.h new file mode 100644 index 0000000000..b7c390f691 --- /dev/null +++ b/tests/framework/instruments/WallClockTimer.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_WALL_CLOCK_TIMER +#define ARM_COMPUTE_TEST_WALL_CLOCK_TIMER + +#include "Instrument.h" + +#include <chrono> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Implementation of an instrument to measure elapsed wall-clock time in milliseconds. */ +class WallClockTimer : public Instrument +{ +public: + std::string id() const override; + void start() override; + void stop() override; + Measurement measurement() const override; + +private: + std::chrono::high_resolution_clock::time_point _start{}; + std::chrono::high_resolution_clock::time_point _stop{}; +}; +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_WALL_CLOCK_TIMER */ diff --git a/tests/framework/printers/JSONPrinter.cpp b/tests/framework/printers/JSONPrinter.cpp new file mode 100644 index 0000000000..5b30389eca --- /dev/null +++ b/tests/framework/printers/JSONPrinter.cpp @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "JSONPrinter.h" + +#include "tests/framework/Framework.h" + +#include <algorithm> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +void JSONPrinter::print_separator(bool &flag) +{ + if(flag) + { + flag = false; + } + else + { + *_stream << ","; + } +} + +void JSONPrinter::print_entry(const std::string &name, const std::string &value) +{ + print_separator(_first_entry); + + *_stream << R"(")" << name << R"(" : ")" << value << R"(")"; +} + +void JSONPrinter::print_global_header() +{ + *_stream << "{"; +} + +void JSONPrinter::print_global_footer() +{ + *_stream << "}\n"; +} + +void JSONPrinter::print_run_header() +{ + print_separator(_first_entry); + + *_stream << R"("tests" : {)"; +} + +void JSONPrinter::print_run_footer() +{ + *_stream << "}"; +} + +void JSONPrinter::print_test_header(const TestInfo &info) +{ + print_separator(_first_test); + + _first_test_entry = true; + *_stream << R"(")" << info.name << R"(" : {)"; +} + +void JSONPrinter::print_test_footer() +{ + *_stream << "}"; +} + +void JSONPrinter::print_errors_header() +{ + print_separator(_first_test_entry); + + _first_error = true; + *_stream << R"("errors" : [)"; +} + +void JSONPrinter::print_errors_footer() +{ + *_stream << "]"; +} + +void JSONPrinter::print_error(const std::exception &error) +{ + std::stringstream error_log; + error_log.str(error.what()); + + for(std::string line; !std::getline(error_log, line).fail();) + { + print_separator(_first_error); + + *_stream << R"(")" << line << R"(")"; + } +} + +void JSONPrinter::print_measurements(const Profiler::MeasurementsMap &measurements) +{ + print_separator(_first_test_entry); + + *_stream << R"("measurements" : {)"; + + for(auto i_it = measurements.cbegin(), i_end = measurements.cend(); i_it != i_end;) + { + *_stream << R"(")" << i_it->first << R"(" : {)"; + + auto add_measurements = [](double a, const Instrument::Measurement & b) + { + return a + b.value; + }; + + auto cmp_measurements = [](const Instrument::Measurement & a, const Instrument::Measurement & b) + { + return a.value < b.value; + }; + + double sum_values = std::accumulate(i_it->second.cbegin(), i_it->second.cend(), 0., add_measurements); + int num_values = i_it->second.size(); + const auto minmax_values = std::minmax_element(i_it->second.begin(), i_it->second.end(), cmp_measurements); + + if(num_values > 2) + { + sum_values -= minmax_values.first->value + minmax_values.second->value; + num_values -= 2; + } + + auto measurement_to_string = [](const Instrument::Measurement & measurement) + { + return support::cpp11::to_string(measurement.value); + }; + + *_stream << R"("avg" : )" << (sum_values / num_values) << ","; + *_stream << R"("min" : )" << minmax_values.first->value << ","; + *_stream << R"("max" : )" << minmax_values.second->value << ","; + *_stream << R"("raw" : [)" << join(i_it->second.begin(), i_it->second.end(), ",", measurement_to_string) << "],"; + *_stream << R"("unit" : ")" << minmax_values.first->unit << R"(")"; + *_stream << "}"; + + if(++i_it != i_end) + { + *_stream << ","; + } + } + + *_stream << "}"; +} +} // namespace framework +} // namespace test +} // namespace arm_compute diff --git a/tests/framework/printers/JSONPrinter.h b/tests/framework/printers/JSONPrinter.h new file mode 100644 index 0000000000..14c8b35cb9 --- /dev/null +++ b/tests/framework/printers/JSONPrinter.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_JSONPRINTER +#define ARM_COMPUTE_TEST_JSONPRINTER + +#include "Printer.h" + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Implementation of a @ref Printer that produces JSON output. */ +class JSONPrinter : public Printer +{ +public: + using Printer::Printer; + + void print_entry(const std::string &name, const std::string &value) override; + void print_global_header() override; + void print_global_footer() override; + void print_run_header() override; + void print_run_footer() override; + void print_test_header(const TestInfo &info) override; + void print_test_footer() override; + void print_errors_header() override; + void print_errors_footer() override; + void print_error(const std::exception &error) override; + void print_measurements(const Profiler::MeasurementsMap &measurements) override; + +private: + void print_separator(bool &flag); + + bool _first_entry{ true }; + bool _first_test{ true }; + bool _first_test_entry{ true }; + bool _first_error{ true }; +}; +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_JSONPRINTER */ diff --git a/tests/framework/printers/PrettyPrinter.cpp b/tests/framework/printers/PrettyPrinter.cpp new file mode 100644 index 0000000000..ec32e5296e --- /dev/null +++ b/tests/framework/printers/PrettyPrinter.cpp @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "PrettyPrinter.h" + +#include "tests/framework/Framework.h" + +#include <algorithm> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +std::string PrettyPrinter::begin_color(const std::string &color) const +{ + if(!_color_output) + { + return ""; + } + + return "\033[0;3" + color + "m"; +} + +std::string PrettyPrinter::end_color() const +{ + if(!_color_output) + { + return ""; + } + + return "\033[m"; +} + +void PrettyPrinter::set_color_output(bool color_output) +{ + _color_output = color_output; +} + +void PrettyPrinter::print_entry(const std::string &name, const std::string &value) +{ + *_stream << begin_color("4") << name << " = " << value << end_color() << "\n"; +} + +void PrettyPrinter::print_global_header() +{ +} + +void PrettyPrinter::print_global_footer() +{ +} + +void PrettyPrinter::print_run_header() +{ +} + +void PrettyPrinter::print_run_footer() +{ +} + +void PrettyPrinter::print_test_header(const TestInfo &info) +{ + *_stream << begin_color("2") << "Running [" << info.id << "] '" << info.name << "'" << end_color() << "\n"; +} + +void PrettyPrinter::print_test_footer() +{ +} + +void PrettyPrinter::print_errors_header() +{ +} + +void PrettyPrinter::print_errors_footer() +{ +} + +void PrettyPrinter::print_error(const std::exception &error) +{ + *_stream << begin_color("1") << "ERROR: " << error.what() << end_color() << "\n"; +} + +void PrettyPrinter::print_measurements(const Profiler::MeasurementsMap &measurements) +{ + for(const auto &instrument : measurements) + { + *_stream << begin_color("3") << " " << instrument.first << ":"; + + auto add_measurements = [](double a, const Instrument::Measurement & b) + { + return a + b.value; + }; + + auto cmp_measurements = [](const Instrument::Measurement & a, const Instrument::Measurement & b) + { + return a.value < b.value; + }; + + double sum_values = std::accumulate(instrument.second.begin(), instrument.second.end(), 0., add_measurements); + int num_values = instrument.second.size(); + const auto minmax_values = std::minmax_element(instrument.second.begin(), instrument.second.end(), cmp_measurements); + + if(num_values > 2) + { + sum_values -= minmax_values.first->value + minmax_values.second->value; + num_values -= 2; + } + + Instrument::Measurement avg{ sum_values / num_values, minmax_values.first->unit }; + + *_stream << " "; + *_stream << "AVG=" << avg << ", "; + *_stream << "MIN=" << *minmax_values.first << ", "; + *_stream << "MAX=" << *minmax_values.second << end_color() << "\n"; + } +} +} // namespace framework +} // namespace test +} // namespace arm_compute diff --git a/tests/framework/printers/PrettyPrinter.h b/tests/framework/printers/PrettyPrinter.h new file mode 100644 index 0000000000..fa7b7b2c59 --- /dev/null +++ b/tests/framework/printers/PrettyPrinter.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_PRETTYPRINTER +#define ARM_COMPUTE_TEST_PRETTYPRINTER + +#include "Printer.h" + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Implementation of a @ref Printer that produces human readable output. */ +class PrettyPrinter : public Printer +{ +public: + using Printer::Printer; + + /** Set if the output is colored. + * + * @param[in] color_output True if the output is colored. + */ + void set_color_output(bool color_output); + + void print_entry(const std::string &name, const std::string &value) override; + void print_global_header() override; + void print_global_footer() override; + void print_run_header() override; + void print_run_footer() override; + void print_test_header(const TestInfo &info) override; + void print_test_footer() override; + void print_errors_header() override; + void print_errors_footer() override; + void print_error(const std::exception &error) override; + void print_measurements(const Profiler::MeasurementsMap &measurements) override; + +private: + std::string begin_color(const std::string &color) const; + std::string end_color() const; + + bool _color_output{ true }; +}; +} // namespace framework +} // namespace test +} // namespace arm_compute + +#endif /* ARM_COMPUTE_TEST_PRETTYPRINTER */ diff --git a/tests/framework/printers/Printer.cpp b/tests/framework/printers/Printer.cpp new file mode 100644 index 0000000000..e034c2ed43 --- /dev/null +++ b/tests/framework/printers/Printer.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "Printer.h" + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +Printer::Printer(std::ostream &stream) + : _stream{ &stream } +{ +} + +void Printer::print(const std::string &str) +{ + *_stream << str; +} + +void Printer::set_stream(std::ostream &stream) +{ + _stream = &stream; +} +} // namespace framework +} // namespace test +} // namespace arm_compute diff --git a/tests/framework/printers/Printer.h b/tests/framework/printers/Printer.h new file mode 100644 index 0000000000..198d84d466 --- /dev/null +++ b/tests/framework/printers/Printer.h @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_PRINTER +#define ARM_COMPUTE_TEST_PRINTER + +#include "tests/framework/Profiler.h" + +#include <fstream> +#include <iostream> +#include <ostream> +#include <stdexcept> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +struct TestInfo; + +/** Abstract printer class used by the @ref Framework to present output. */ +class Printer +{ +public: + /** Default constructor. + * + * Prints values to std::cout. + * */ + Printer() = default; + + /** Construct printer with given output stream. + * + * @param[out] stream Output stream. + */ + Printer(std::ostream &stream); + + Printer(const Printer &) = delete; + Printer &operator=(const Printer &) = delete; + Printer(Printer &&) = default; + Printer &operator=(Printer &&) = default; + + virtual ~Printer() = default; + + /** Print given string. + * + * @param[in] str String. + */ + void print(const std::string &str); + + /** Print an entry consisting of a (name, value) pair. + * + * @param[in] name Description of the value. + * @param[in] value Value. + */ + virtual void print_entry(const std::string &name, const std::string &value) = 0; + + /** Print global header. */ + virtual void print_global_header() = 0; + + /** Print global footer. */ + virtual void print_global_footer() = 0; + + /** Print header before running all tests. */ + virtual void print_run_header() = 0; + + /** Print footer after running all tests. */ + virtual void print_run_footer() = 0; + + /** Print header before a test. + * + * @param[in] info Test info. + */ + virtual void print_test_header(const TestInfo &info) = 0; + + /** Print footer after a test. */ + virtual void print_test_footer() = 0; + + /** Print header before errors. */ + virtual void print_errors_header() = 0; + + /** Print footer after errors. */ + virtual void print_errors_footer() = 0; + + /** Print test error. + * + * @param[in] error Description of the error. + */ + virtual void print_error(const std::exception &error) = 0; + + /** Print measurements for a test. + * + * @param[in] measurements Measurements as collected by a @ref Profiler. + */ + virtual void print_measurements(const Profiler::MeasurementsMap &measurements) = 0; + + /** Set the output stream. + * + * @param[out] stream Output stream. + */ + void set_stream(std::ostream &stream); + +protected: + std::ostream *_stream{ &std::cout }; +}; +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_PRINTER */ diff --git a/tests/framework/printers/Printers.cpp b/tests/framework/printers/Printers.cpp new file mode 100644 index 0000000000..6e11b63a9a --- /dev/null +++ b/tests/framework/printers/Printers.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "Printers.h" + +#include "../Utils.h" + +#include <map> +#include <stdexcept> + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +LogFormat log_format_from_name(const std::string &name) +{ + static const std::map<std::string, LogFormat> formats = + { + { "pretty", LogFormat::PRETTY }, + { "none", LogFormat::NONE }, + { "json", LogFormat::JSON }, + }; + + try + { + return formats.at(tolower(name)); + } + catch(const std::out_of_range &) + { + throw std::invalid_argument(name); + } +} +} // namespace framework +} // namespace test +} // namespace arm_compute diff --git a/tests/framework/printers/Printers.h b/tests/framework/printers/Printers.h new file mode 100644 index 0000000000..53867e2dff --- /dev/null +++ b/tests/framework/printers/Printers.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_PRINTERS +#define ARM_COMPUTE_TEST_PRINTERS + +#include "JSONPrinter.h" +#include "PrettyPrinter.h" + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +enum class LogFormat +{ + NONE, + JSON, + PRETTY +}; + +LogFormat log_format_from_name(const std::string &name); + +inline ::std::stringstream &operator>>(::std::stringstream &stream, LogFormat &format) +{ + std::string value; + stream >> value; + format = log_format_from_name(value); + return stream; +} + +inline ::std::stringstream &operator<<(::std::stringstream &stream, LogFormat format) +{ + switch(format) + { + case LogFormat::PRETTY: + stream << "PRETTY"; + break; + case LogFormat::NONE: + stream << "NONE"; + break; + case LogFormat::JSON: + stream << "JSON"; + break; + default: + throw std::invalid_argument("Unsupported log format"); + } + + return stream; +} +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_PRINTERS */ diff --git a/tests/main.cpp b/tests/main.cpp index 0b01185fc9..9cd2895e1b 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "framework/DatasetModes.h" -#include "framework/Exceptions.h" -#include "framework/Framework.h" -#include "framework/Macros.h" -#include "framework/command_line/CommandLineOptions.h" -#include "framework/command_line/CommandLineParser.h" -#include "framework/instruments/Instruments.h" -#include "framework/printers/Printers.h" #include "support/ToolchainSupport.h" #include "tests/AssetsLibrary.h" +#include "tests/framework/DatasetModes.h" +#include "tests/framework/Exceptions.h" +#include "tests/framework/Framework.h" +#include "tests/framework/Macros.h" +#include "tests/framework/command_line/CommandLineOptions.h" +#include "tests/framework/command_line/CommandLineParser.h" +#include "tests/framework/instruments/Instruments.h" +#include "tests/framework/printers/Printers.h" #ifdef ARM_COMPUTE_CL #include "arm_compute/runtime/CL/CLScheduler.h" diff --git a/tests/networks_new/AlexNetNetwork.h b/tests/networks/AlexNetNetwork.h index 11171d6ec2..d41e1b676c 100644 --- a/tests/networks_new/AlexNetNetwork.h +++ b/tests/networks/AlexNetNetwork.h @@ -26,9 +26,9 @@ #include "arm_compute/runtime/Tensor.h" -#include "AssetsLibrary.h" -#include "Globals.h" -#include "Utils.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/Utils.h" #include <memory> diff --git a/tests/networks_new/LeNet5Network.h b/tests/networks/LeNet5Network.h index 33cb59bbd2..ed7ac18f40 100644 --- a/tests/networks_new/LeNet5Network.h +++ b/tests/networks/LeNet5Network.h @@ -24,9 +24,9 @@ #ifndef __ARM_COMPUTE_TEST_MODEL_OBJECTS_LENET5_H__ #define __ARM_COMPUTE_TEST_MODEL_OBJECTS_LENET5_H__ -#include "AssetsLibrary.h" -#include "Globals.h" -#include "Utils.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/Utils.h" #include <memory> diff --git a/tests/validation_new/CL/ActivationLayer.cpp b/tests/validation/CL/ActivationLayer.cpp index c8fddc7db6..097fb638f9 100644 --- a/tests/validation_new/CL/ActivationLayer.cpp +++ b/tests/validation/CL/ActivationLayer.cpp @@ -25,16 +25,16 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLActivationLayer.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ActivationFunctionsDataset.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/ActivationLayerFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/ActivationFunctionsDataset.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/ActivationLayerFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CL/BitwiseAnd.cpp b/tests/validation/CL/BitwiseAnd.cpp index af40812b2a..3e458a4c9b 100644 --- a/tests/validation_new/CL/BitwiseAnd.cpp +++ b/tests/validation/CL/BitwiseAnd.cpp @@ -25,14 +25,14 @@ #include "arm_compute/runtime/CL/functions/CLBitwiseAnd.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/BitwiseAndFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/BitwiseAndFixture.h" namespace arm_compute { diff --git a/tests/validation_new/CL/BitwiseNot.cpp b/tests/validation/CL/BitwiseNot.cpp index e95619f481..376bde9c78 100644 --- a/tests/validation_new/CL/BitwiseNot.cpp +++ b/tests/validation/CL/BitwiseNot.cpp @@ -25,14 +25,14 @@ #include "arm_compute/runtime/CL/functions/CLBitwiseNot.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/BitwiseNotFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/BitwiseNotFixture.h" namespace arm_compute { diff --git a/tests/validation_new/CL/BitwiseOr.cpp b/tests/validation/CL/BitwiseOr.cpp index 15964eecc3..ecff0be6c0 100644 --- a/tests/validation_new/CL/BitwiseOr.cpp +++ b/tests/validation/CL/BitwiseOr.cpp @@ -25,14 +25,14 @@ #include "arm_compute/runtime/CL/functions/CLBitwiseOr.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/BitwiseOrFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/BitwiseOrFixture.h" namespace arm_compute { diff --git a/tests/validation_new/CL/BitwiseXor.cpp b/tests/validation/CL/BitwiseXor.cpp index 8e8852209b..3104894c29 100644 --- a/tests/validation_new/CL/BitwiseXor.cpp +++ b/tests/validation/CL/BitwiseXor.cpp @@ -25,14 +25,14 @@ #include "arm_compute/runtime/CL/functions/CLBitwiseXor.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/BitwiseXorFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/BitwiseXorFixture.h" namespace arm_compute { diff --git a/tests/validation/CL/CMakeLists.txt b/tests/validation/CL/CMakeLists.txt deleted file mode 100644 index f4477f621f..0000000000 --- a/tests/validation/CL/CMakeLists.txt +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright (c) 2017 ARM Limited. -# -# SPDX-License-Identifier: MIT -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -cmake_minimum_required (VERSION 3.1) - -include_directories(${CMAKE_SOURCE_DIR}/../include) - -set(arm_compute_test_validation_OPENCL_SOURCE_FILES - ${CMAKE_SOURCE_DIR}/CL/CLAccessor.h - ${CMAKE_CURRENT_SOURCE_DIR}/CLFixture.h - ${CMAKE_CURRENT_SOURCE_DIR}/CLFixture.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/ActivationLayer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/BitwiseAnd.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Box3x3.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/ConvolutionLayer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/DepthConvert.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/FillBorder.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/FixedPoint/FixedPoint_QS8.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/FullyConnectedLayer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Gaussian3x3.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Gaussian5x5.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/GEMM.cpp -` ${CMAKE_CURRENT_SOURCE_DIR}/IntegralImage.cpp -` ${CMAKE_CURRENT_SOURCE_DIR}/NonLinearFilter.cpp -` ${CMAKE_CURRENT_SOURCE_DIR}/PoolingLayer.cpp -` ${CMAKE_CURRENT_SOURCE_DIR}/ROIPoolingLayer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Sobel3x3.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Sobel5x5.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/SoftmaxLayer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Threshold.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/DirectConvolutionLayer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/MeanStdDev.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/HarrisCorners.cpp -) - -add_library(arm_compute_test_validation_OPENCL OBJECT - ${arm_compute_test_validation_OPENCL_SOURCE_FILES} -) - -set(arm_compute_test_validation_TARGET_OBJECTS - ${arm_compute_test_validation_TARGET_OBJECTS} - $<TARGET_OBJECTS:arm_compute_test_validation_OPENCL> - PARENT_SCOPE -) - -set(arm_compute_test_validation_TARGET_LIBRARIES - ${arm_compute_test_validation_TARGET_LIBRARIES} - OpenCL - PARENT_SCOPE -) diff --git a/tests/validation_new/CL/ConvolutionLayer.cpp b/tests/validation/CL/ConvolutionLayer.cpp index 9703e0bcba..d7123842e9 100644 --- a/tests/validation_new/CL/ConvolutionLayer.cpp +++ b/tests/validation/CL/ConvolutionLayer.cpp @@ -25,16 +25,16 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLConvolutionLayer.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/LargeConvolutionLayerDataset.h" -#include "tests/datasets_new/SmallConvolutionLayerDataset.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/ConvolutionLayerFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/LargeConvolutionLayerDataset.h" +#include "tests/datasets/SmallConvolutionLayerDataset.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/ConvolutionLayerFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CL/DepthConcatenateLayer.cpp b/tests/validation/CL/DepthConcatenateLayer.cpp index ff64e2340b..a8ef1c37c7 100644 --- a/tests/validation_new/CL/DepthConcatenateLayer.cpp +++ b/tests/validation/CL/DepthConcatenateLayer.cpp @@ -25,14 +25,14 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLDepthConcatenate.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/DepthConcatenateLayerFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/DepthConcatenateLayerFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CL/DepthwiseConvolution.cpp b/tests/validation/CL/DepthwiseConvolution.cpp index 3fda275715..ccee9607d3 100644 --- a/tests/validation_new/CL/DepthwiseConvolution.cpp +++ b/tests/validation/CL/DepthwiseConvolution.cpp @@ -25,15 +25,15 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLDepthwiseConvolution.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/LargeDepthwiseConvolutionDataset.h" -#include "tests/datasets_new/SmallDepthwiseConvolutionDataset.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/DepthwiseConvolutionFixture.h" +#include "tests/datasets/LargeDepthwiseConvolutionDataset.h" +#include "tests/datasets/SmallDepthwiseConvolutionDataset.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/DepthwiseConvolutionFixture.h" namespace arm_compute { diff --git a/tests/validation_new/CL/DepthwiseSeparableConvolutionLayer.cpp b/tests/validation/CL/DepthwiseSeparableConvolutionLayer.cpp index e577f5af04..4fac9b2d0d 100644 --- a/tests/validation_new/CL/DepthwiseSeparableConvolutionLayer.cpp +++ b/tests/validation/CL/DepthwiseSeparableConvolutionLayer.cpp @@ -25,14 +25,14 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLDepthwiseSeparableConvolutionLayer.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/MobileNetDepthwiseSeparableConvolutionLayerDataset.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/DepthwiseSeparableConvolutionLayerFixture.h" +#include "tests/datasets/MobileNetDepthwiseSeparableConvolutionLayerDataset.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/DepthwiseSeparableConvolutionLayerFixture.h" namespace arm_compute { diff --git a/tests/validation_new/CL/DirectConvolutionLayer.cpp b/tests/validation/CL/DirectConvolutionLayer.cpp index 1c698ace0f..d2d2cd1419 100644 --- a/tests/validation_new/CL/DirectConvolutionLayer.cpp +++ b/tests/validation/CL/DirectConvolutionLayer.cpp @@ -25,15 +25,15 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLDirectConvolutionLayer.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/DirectConvolutionLayerFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/DirectConvolutionLayerFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CL/Floor.cpp b/tests/validation/CL/Floor.cpp index 461a914be9..81495e8337 100644 --- a/tests/validation_new/CL/Floor.cpp +++ b/tests/validation/CL/Floor.cpp @@ -25,14 +25,14 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLFloor.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/FloorFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/FloorFixture.h" namespace arm_compute { diff --git a/tests/validation_new/CL/FullyConnectedLayer.cpp b/tests/validation/CL/FullyConnectedLayer.cpp index e43997c47b..7a8734b5a3 100644 --- a/tests/validation_new/CL/FullyConnectedLayer.cpp +++ b/tests/validation/CL/FullyConnectedLayer.cpp @@ -25,15 +25,15 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/FullyConnectedLayerDataset.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/FullyConnectedLayerFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/FullyConnectedLayerDataset.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/FullyConnectedLayerFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CL/GEMM.cpp b/tests/validation/CL/GEMM.cpp index 7da5da3ed9..6b2b2b41b1 100644 --- a/tests/validation_new/CL/GEMM.cpp +++ b/tests/validation/CL/GEMM.cpp @@ -25,16 +25,16 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLGEMM.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/LargeGEMMDataset.h" -#include "tests/datasets_new/SmallGEMMDataset.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/GEMMFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/LargeGEMMDataset.h" +#include "tests/datasets/SmallGEMMDataset.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/GEMMFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CL/L2Normalize.cpp b/tests/validation/CL/L2Normalize.cpp index d7882a842a..bd9bf17322 100644 --- a/tests/validation_new/CL/L2Normalize.cpp +++ b/tests/validation/CL/L2Normalize.cpp @@ -25,15 +25,15 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLL2Normalize.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/L2NormalizeFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/L2NormalizeFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CL/MeanStdDev.cpp b/tests/validation/CL/MeanStdDev.cpp index 494e1001bc..ff8a087c6b 100644 --- a/tests/validation_new/CL/MeanStdDev.cpp +++ b/tests/validation/CL/MeanStdDev.cpp @@ -22,12 +22,12 @@ * SOFTWARE. */ #include "arm_compute/runtime/CL/functions/CLMeanStdDev.h" -#include "framework/Macros.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/MeanStdDevFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Macros.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/MeanStdDevFixture.h" namespace arm_compute { diff --git a/tests/validation_new/CL/NormalizationLayer.cpp b/tests/validation/CL/NormalizationLayer.cpp index 37e77f3632..4d14649a91 100644 --- a/tests/validation_new/CL/NormalizationLayer.cpp +++ b/tests/validation/CL/NormalizationLayer.cpp @@ -25,16 +25,16 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLNormalizationLayer.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/NormalizationTypesDataset.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/NormalizationLayerFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/NormalizationTypesDataset.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/NormalizationLayerFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CL/PoolingLayer.cpp b/tests/validation/CL/PoolingLayer.cpp index d38a3b2c6a..24380cb1f0 100644 --- a/tests/validation_new/CL/PoolingLayer.cpp +++ b/tests/validation/CL/PoolingLayer.cpp @@ -25,16 +25,16 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLPoolingLayer.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/PoolingTypesDataset.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/PoolingLayerFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/PoolingTypesDataset.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/PoolingLayerFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CL/ReductionOperation.cpp b/tests/validation/CL/ReductionOperation.cpp index af49d736ab..5896add68f 100644 --- a/tests/validation_new/CL/ReductionOperation.cpp +++ b/tests/validation/CL/ReductionOperation.cpp @@ -25,16 +25,16 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLReductionOperation.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ReductionOperationDataset.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/ReductionOperationFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/ReductionOperationDataset.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/ReductionOperationFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CL/Scale.cpp b/tests/validation/CL/Scale.cpp index e28555ac21..d5866fad97 100644 --- a/tests/validation_new/CL/Scale.cpp +++ b/tests/validation/CL/Scale.cpp @@ -26,16 +26,16 @@ #include "arm_compute/runtime/CL/functions/CLScale.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/BorderModeDataset.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Helpers.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/ScaleFixture.h" +#include "tests/datasets/BorderModeDataset.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Helpers.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/ScaleFixture.h" namespace arm_compute { diff --git a/tests/validation_new/CL/SoftmaxLayer.cpp b/tests/validation/CL/SoftmaxLayer.cpp index d13236a2f9..c4a9970b78 100644 --- a/tests/validation_new/CL/SoftmaxLayer.cpp +++ b/tests/validation/CL/SoftmaxLayer.cpp @@ -25,15 +25,15 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLSoftmaxLayer.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/SoftmaxLayerFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/SoftmaxLayerFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation/CMakeLists.txt b/tests/validation/CMakeLists.txt deleted file mode 100644 index 3d8f56610b..0000000000 --- a/tests/validation/CMakeLists.txt +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright (c) 2017 ARM Limited. -# -# SPDX-License-Identifier: MIT -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -cmake_minimum_required (VERSION 3.1) - -add_library(openvx SHARED IMPORTED) -set_target_properties(openvx PROPERTIES - IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/../3rdparty/linux/armv7a/libopenvx.so" -) - -add_library(vxu SHARED IMPORTED) -set_target_properties(vxu PROPERTIES - IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/../3rdparty/linux/armv7a/libvxu.so" -) - -add_library(OpenCL SHARED IMPORTED) -set_target_properties(OpenCL PROPERTIES - IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/../build/opencl-1.2-stubs/libOpenCL.so" - IMPORTED_NO_SONAME 1 -) - -add_definitions(-DBOOST) - -set(ARM_COMPUTE_TARGETS_TO_VALIDATE "all" CACHE STRING "Semicolon-separated list of targets to include in validation.") - -set(ARM_COMPUTE_ALL_TARGETS - NEON - CL - UNIT - VX -) - -if(ARM_COMPUTE_TARGETS_TO_VALIDATE STREQUAL "all") - set(ARM_COMPUTE_TARGETS_TO_VALIDATE ${ARM_COMPUTE_ALL_TARGETS}) -endif() - -list(REMOVE_DUPLICATES ARM_COMPUTE_TARGETS_TO_VALIDATE) - -foreach(TARGET ${ARM_COMPUTE_TARGETS_TO_VALIDATE}) - list(FIND ARM_COMPUTE_ALL_TARGETS ${TARGET} idx) - - if(${idx} LESS 0) - message(FATAL_ERROR "The target '${TARGET}' does not exist. It should be one of\n${ARM_COMPUTE_ALL_TARGETS}") - else() - add_subdirectory(${TARGET}) - endif() -endforeach() - -set(arm_compute_test_validation_SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Datasets.h - ${CMAKE_CURRENT_SOURCE_DIR}/Reference.h - ${CMAKE_CURRENT_SOURCE_DIR}/Reference.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/ReferenceCPP.h - ${CMAKE_CURRENT_SOURCE_DIR}/ReferenceCPP.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Validation.h - ${CMAKE_CURRENT_SOURCE_DIR}/Validation.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/ValidationProgramOptions.h - ${CMAKE_CURRENT_SOURCE_DIR}/ValidationUserConfiguration.h -) - -add_library(arm_compute_test_validation OBJECT - ${arm_compute_test_validation_SOURCE_FILES} -) - -add_executable(arm_compute_validation - $<TARGET_OBJECTS:arm_compute_test_validation> - ${arm_compute_test_validation_TARGET_OBJECTS} - $<TARGET_OBJECTS:tensor_library> - $<TARGET_OBJECTS:arm_compute_test> -) - -target_link_libraries(arm_compute_validation - boost_unit_test_framework - boost_program_options - arm_compute - ${arm_compute_test_validation_TARGET_LIBRARIES} -) diff --git a/tests/validation_new/CPP/ActivationLayer.cpp b/tests/validation/CPP/ActivationLayer.cpp index 052c3aa566..fa393be5e1 100644 --- a/tests/validation_new/CPP/ActivationLayer.cpp +++ b/tests/validation/CPP/ActivationLayer.cpp @@ -23,9 +23,9 @@ */ #include "ActivationLayer.h" -#include "tests/validation_new/FixedPoint.h" -#include "tests/validation_new/Helpers.h" -#include "tests/validation_new/half.h" +#include "tests/validation/FixedPoint.h" +#include "tests/validation/Helpers.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/ActivationLayer.h b/tests/validation/CPP/ActivationLayer.h index 3f10a2f360..09f602ffa1 100644 --- a/tests/validation_new/CPP/ActivationLayer.h +++ b/tests/validation/CPP/ActivationLayer.h @@ -25,7 +25,7 @@ #define __ARM_COMPUTE_TEST_ACTIVATION_LAYER_H__ #include "tests/SimpleTensor.h" -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/BitwiseAnd.cpp b/tests/validation/CPP/BitwiseAnd.cpp index 6fc46b402b..6fc46b402b 100644 --- a/tests/validation_new/CPP/BitwiseAnd.cpp +++ b/tests/validation/CPP/BitwiseAnd.cpp diff --git a/tests/validation_new/CPP/BitwiseAnd.h b/tests/validation/CPP/BitwiseAnd.h index eba2fd695f..eba2fd695f 100644 --- a/tests/validation_new/CPP/BitwiseAnd.h +++ b/tests/validation/CPP/BitwiseAnd.h diff --git a/tests/validation_new/CPP/BitwiseNot.cpp b/tests/validation/CPP/BitwiseNot.cpp index 5a6a13b56c..5a6a13b56c 100644 --- a/tests/validation_new/CPP/BitwiseNot.cpp +++ b/tests/validation/CPP/BitwiseNot.cpp diff --git a/tests/validation_new/CPP/BitwiseNot.h b/tests/validation/CPP/BitwiseNot.h index b4206f9388..b4206f9388 100644 --- a/tests/validation_new/CPP/BitwiseNot.h +++ b/tests/validation/CPP/BitwiseNot.h diff --git a/tests/validation_new/CPP/BitwiseOr.cpp b/tests/validation/CPP/BitwiseOr.cpp index fc258d54f1..fc258d54f1 100644 --- a/tests/validation_new/CPP/BitwiseOr.cpp +++ b/tests/validation/CPP/BitwiseOr.cpp diff --git a/tests/validation_new/CPP/BitwiseOr.h b/tests/validation/CPP/BitwiseOr.h index 39158cb411..39158cb411 100644 --- a/tests/validation_new/CPP/BitwiseOr.h +++ b/tests/validation/CPP/BitwiseOr.h diff --git a/tests/validation_new/CPP/BitwiseXor.cpp b/tests/validation/CPP/BitwiseXor.cpp index b8d275d8b5..b8d275d8b5 100644 --- a/tests/validation_new/CPP/BitwiseXor.cpp +++ b/tests/validation/CPP/BitwiseXor.cpp diff --git a/tests/validation_new/CPP/BitwiseXor.h b/tests/validation/CPP/BitwiseXor.h index 3e7721e843..3e7721e843 100644 --- a/tests/validation_new/CPP/BitwiseXor.h +++ b/tests/validation/CPP/BitwiseXor.h diff --git a/tests/validation_new/CPP/ConvolutionLayer.cpp b/tests/validation/CPP/ConvolutionLayer.cpp index a24621a3f2..1824ada791 100644 --- a/tests/validation_new/CPP/ConvolutionLayer.cpp +++ b/tests/validation/CPP/ConvolutionLayer.cpp @@ -23,9 +23,9 @@ */ #include "ConvolutionLayer.h" -#include "tests/validation_new/FixedPoint.h" -#include "tests/validation_new/Helpers.h" -#include "tests/validation_new/half.h" +#include "tests/validation/FixedPoint.h" +#include "tests/validation/Helpers.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/ConvolutionLayer.h b/tests/validation/CPP/ConvolutionLayer.h index a7c9e086a4..117e846b1c 100644 --- a/tests/validation_new/CPP/ConvolutionLayer.h +++ b/tests/validation/CPP/ConvolutionLayer.h @@ -25,7 +25,7 @@ #define __ARM_COMPUTE_TEST_CONVOLUTION_LAYER_H__ #include "tests/SimpleTensor.h" -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/DepthConcatenateLayer.cpp b/tests/validation/CPP/DepthConcatenateLayer.cpp index c54c6c8568..139d26f2b6 100644 --- a/tests/validation_new/CPP/DepthConcatenateLayer.cpp +++ b/tests/validation/CPP/DepthConcatenateLayer.cpp @@ -23,9 +23,9 @@ */ #include "DepthConcatenateLayer.h" -#include "tests/validation_new/FixedPoint.h" -#include "tests/validation_new/Helpers.h" -#include "tests/validation_new/half.h" +#include "tests/validation/FixedPoint.h" +#include "tests/validation/Helpers.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/DepthConcatenateLayer.h b/tests/validation/CPP/DepthConcatenateLayer.h index 3c486a8015..3c486a8015 100644 --- a/tests/validation_new/CPP/DepthConcatenateLayer.h +++ b/tests/validation/CPP/DepthConcatenateLayer.h diff --git a/tests/validation_new/CPP/DepthwiseConvolution.cpp b/tests/validation/CPP/DepthwiseConvolution.cpp index 8c5cec596e..ebca333715 100644 --- a/tests/validation_new/CPP/DepthwiseConvolution.cpp +++ b/tests/validation/CPP/DepthwiseConvolution.cpp @@ -26,8 +26,8 @@ #include "ConvolutionLayer.h" #include "Utils.h" -#include "tests/validation_new/Helpers.h" -#include "tests/validation_new/half.h" +#include "tests/validation/Helpers.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/DepthwiseConvolution.h b/tests/validation/CPP/DepthwiseConvolution.h index 4a92620880..6be80fc07f 100644 --- a/tests/validation_new/CPP/DepthwiseConvolution.h +++ b/tests/validation/CPP/DepthwiseConvolution.h @@ -25,7 +25,7 @@ #define __ARM_COMPUTE_TEST_DEPTHWISE_CONVOLUTION_H__ #include "tests/SimpleTensor.h" -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/DepthwiseSeparableConvolutionLayer.cpp b/tests/validation/CPP/DepthwiseSeparableConvolutionLayer.cpp index eba0a19189..7020a854cf 100644 --- a/tests/validation_new/CPP/DepthwiseSeparableConvolutionLayer.cpp +++ b/tests/validation/CPP/DepthwiseSeparableConvolutionLayer.cpp @@ -28,8 +28,8 @@ #include "ConvolutionLayer.h" #include "Utils.h" -#include "tests/validation_new/Helpers.h" -#include "tests/validation_new/half.h" +#include "tests/validation/Helpers.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/DepthwiseSeparableConvolutionLayer.h b/tests/validation/CPP/DepthwiseSeparableConvolutionLayer.h index 0c9f118b84..71cd013424 100644 --- a/tests/validation_new/CPP/DepthwiseSeparableConvolutionLayer.h +++ b/tests/validation/CPP/DepthwiseSeparableConvolutionLayer.h @@ -25,7 +25,7 @@ #define __ARM_COMPUTE_TEST_DEPTHWISE_SEPARABLE_CONVOLUTION_LAYER_H__ #include "tests/SimpleTensor.h" -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/DequantizationLayer.cpp b/tests/validation/CPP/DequantizationLayer.cpp index 1c7ec25255..1c7ec25255 100644 --- a/tests/validation_new/CPP/DequantizationLayer.cpp +++ b/tests/validation/CPP/DequantizationLayer.cpp diff --git a/tests/validation_new/CPP/DequantizationLayer.h b/tests/validation/CPP/DequantizationLayer.h index 33592b89b8..3aae338116 100644 --- a/tests/validation_new/CPP/DequantizationLayer.h +++ b/tests/validation/CPP/DequantizationLayer.h @@ -25,7 +25,7 @@ #define __ARM_COMPUTE_TEST_DEQUANTIZATION_LAYER_H__ #include "tests/SimpleTensor.h" -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/Floor.cpp b/tests/validation/CPP/Floor.cpp index aed4fecd01..1c739448b7 100644 --- a/tests/validation_new/CPP/Floor.cpp +++ b/tests/validation/CPP/Floor.cpp @@ -23,7 +23,7 @@ */ #include "Floor.h" -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" #include <cmath> diff --git a/tests/validation_new/CPP/Floor.h b/tests/validation/CPP/Floor.h index 30b8118622..d95ee303fc 100644 --- a/tests/validation_new/CPP/Floor.h +++ b/tests/validation/CPP/Floor.h @@ -25,7 +25,7 @@ #define __ARM_COMPUTE_TEST_FLOOR_H__ #include "tests/SimpleTensor.h" -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/FullyConnectedLayer.cpp b/tests/validation/CPP/FullyConnectedLayer.cpp index 7852dab27b..a146535bd9 100644 --- a/tests/validation_new/CPP/FullyConnectedLayer.cpp +++ b/tests/validation/CPP/FullyConnectedLayer.cpp @@ -23,8 +23,8 @@ */ #include "FullyConnectedLayer.h" -#include "tests/validation_new/FixedPoint.h" -#include "tests/validation_new/half.h" +#include "tests/validation/FixedPoint.h" +#include "tests/validation/half.h" #include <numeric> diff --git a/tests/validation_new/CPP/FullyConnectedLayer.h b/tests/validation/CPP/FullyConnectedLayer.h index 5d62179f57..05c570a2c0 100644 --- a/tests/validation_new/CPP/FullyConnectedLayer.h +++ b/tests/validation/CPP/FullyConnectedLayer.h @@ -25,7 +25,7 @@ #define __ARM_COMPUTE_TEST_FULLY_CONNECTED_LAYER_H__ #include "tests/SimpleTensor.h" -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/GEMM.cpp b/tests/validation/CPP/GEMM.cpp index 424633f8e7..9b66597eb8 100644 --- a/tests/validation_new/CPP/GEMM.cpp +++ b/tests/validation/CPP/GEMM.cpp @@ -23,8 +23,8 @@ */ #include "GEMM.h" -#include "tests/validation_new/FixedPoint.h" -#include "tests/validation_new/half.h" +#include "tests/validation/FixedPoint.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/GEMM.h b/tests/validation/CPP/GEMM.h index 7fea2a9862..cda792bf8b 100644 --- a/tests/validation_new/CPP/GEMM.h +++ b/tests/validation/CPP/GEMM.h @@ -25,7 +25,7 @@ #define __ARM_COMPUTE_TEST_GEMM_H__ #include "tests/SimpleTensor.h" -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/L2Normalize.cpp b/tests/validation/CPP/L2Normalize.cpp index f423702819..4fb4d57eb4 100644 --- a/tests/validation_new/CPP/L2Normalize.cpp +++ b/tests/validation/CPP/L2Normalize.cpp @@ -24,7 +24,7 @@ #include "L2Normalize.h" #include "ReductionOperation.h" -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" #include <algorithm> #include <cmath> diff --git a/tests/validation_new/CPP/L2Normalize.h b/tests/validation/CPP/L2Normalize.h index da36a73bba..1db3ae6174 100644 --- a/tests/validation_new/CPP/L2Normalize.h +++ b/tests/validation/CPP/L2Normalize.h @@ -25,7 +25,7 @@ #define __ARM_COMPUTE_TEST_L2NORMALIZE_H__ #include "tests/SimpleTensor.h" -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/MeanStdDev.cpp b/tests/validation/CPP/MeanStdDev.cpp index 4a39b13d56..4a39b13d56 100644 --- a/tests/validation_new/CPP/MeanStdDev.cpp +++ b/tests/validation/CPP/MeanStdDev.cpp diff --git a/tests/validation_new/CPP/MeanStdDev.h b/tests/validation/CPP/MeanStdDev.h index 6b89ae0656..6b89ae0656 100644 --- a/tests/validation_new/CPP/MeanStdDev.h +++ b/tests/validation/CPP/MeanStdDev.h diff --git a/tests/validation_new/CPP/NormalizationLayer.cpp b/tests/validation/CPP/NormalizationLayer.cpp index a8818d8b5c..3c6f5e1a54 100644 --- a/tests/validation_new/CPP/NormalizationLayer.cpp +++ b/tests/validation/CPP/NormalizationLayer.cpp @@ -23,8 +23,8 @@ */ #include "NormalizationLayer.h" -#include "tests/validation_new/FixedPoint.h" -#include "tests/validation_new/half.h" +#include "tests/validation/FixedPoint.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/NormalizationLayer.h b/tests/validation/CPP/NormalizationLayer.h index bdd87545ca..3f624ff30a 100644 --- a/tests/validation_new/CPP/NormalizationLayer.h +++ b/tests/validation/CPP/NormalizationLayer.h @@ -25,7 +25,7 @@ #define __ARM_COMPUTE_TEST_NORMALIZATION_LAYER_H__ #include "tests/SimpleTensor.h" -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/PoolingLayer.cpp b/tests/validation/CPP/PoolingLayer.cpp index 5464885dc4..c4425ca9a1 100644 --- a/tests/validation_new/CPP/PoolingLayer.cpp +++ b/tests/validation/CPP/PoolingLayer.cpp @@ -23,8 +23,8 @@ */ #include "PoolingLayer.h" -#include "tests/validation_new/FixedPoint.h" -#include "tests/validation_new/half.h" +#include "tests/validation/FixedPoint.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/PoolingLayer.h b/tests/validation/CPP/PoolingLayer.h index 0935fb02f9..334054a0eb 100644 --- a/tests/validation_new/CPP/PoolingLayer.h +++ b/tests/validation/CPP/PoolingLayer.h @@ -25,7 +25,7 @@ #define __ARM_COMPUTE_TEST_POOLING_LAYER_H__ #include "tests/SimpleTensor.h" -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/QuantizationLayer.cpp b/tests/validation/CPP/QuantizationLayer.cpp index d61e75a3a9..d61e75a3a9 100644 --- a/tests/validation_new/CPP/QuantizationLayer.cpp +++ b/tests/validation/CPP/QuantizationLayer.cpp diff --git a/tests/validation_new/CPP/QuantizationLayer.h b/tests/validation/CPP/QuantizationLayer.h index c696ab0c85..7c5572ccf8 100644 --- a/tests/validation_new/CPP/QuantizationLayer.h +++ b/tests/validation/CPP/QuantizationLayer.h @@ -25,7 +25,7 @@ #define __ARM_COMPUTE_TEST_QUANTIZATION_LAYER_H__ #include "tests/SimpleTensor.h" -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/ReductionOperation.cpp b/tests/validation/CPP/ReductionOperation.cpp index f4c5c21182..acfcc09cea 100644 --- a/tests/validation_new/CPP/ReductionOperation.cpp +++ b/tests/validation/CPP/ReductionOperation.cpp @@ -23,7 +23,7 @@ */ #include "ReductionOperation.h" -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" #include <algorithm> #include <cmath> diff --git a/tests/validation_new/CPP/ReductionOperation.h b/tests/validation/CPP/ReductionOperation.h index 500a8162fd..6da6436686 100644 --- a/tests/validation_new/CPP/ReductionOperation.h +++ b/tests/validation/CPP/ReductionOperation.h @@ -25,7 +25,7 @@ #define __ARM_COMPUTE_TEST_REDUCTION_OPERATION_H__ #include "tests/SimpleTensor.h" -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/Scale.cpp b/tests/validation/CPP/Scale.cpp index a1119f33b9..a1119f33b9 100644 --- a/tests/validation_new/CPP/Scale.cpp +++ b/tests/validation/CPP/Scale.cpp diff --git a/tests/validation_new/CPP/Scale.h b/tests/validation/CPP/Scale.h index b882915946..b882915946 100644 --- a/tests/validation_new/CPP/Scale.h +++ b/tests/validation/CPP/Scale.h diff --git a/tests/validation_new/CPP/SoftmaxLayer.cpp b/tests/validation/CPP/SoftmaxLayer.cpp index 8c2cda8296..4fe87d07dc 100644 --- a/tests/validation_new/CPP/SoftmaxLayer.cpp +++ b/tests/validation/CPP/SoftmaxLayer.cpp @@ -23,8 +23,8 @@ */ #include "SoftmaxLayer.h" -#include "tests/validation_new/FixedPoint.h" -#include "tests/validation_new/half.h" +#include "tests/validation/FixedPoint.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/SoftmaxLayer.h b/tests/validation/CPP/SoftmaxLayer.h index cc52f3cf51..ab79bc4850 100644 --- a/tests/validation_new/CPP/SoftmaxLayer.h +++ b/tests/validation/CPP/SoftmaxLayer.h @@ -25,7 +25,7 @@ #define __ARM_COMPUTE_TEST_SOFTMAX_LAYER_H__ #include "tests/SimpleTensor.h" -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/Utils.cpp b/tests/validation/CPP/Utils.cpp index c89807b69a..05443eabae 100644 --- a/tests/validation_new/CPP/Utils.cpp +++ b/tests/validation/CPP/Utils.cpp @@ -23,8 +23,8 @@ */ #include "Utils.h" -#include "tests/validation_new/Helpers.h" -#include "tests/validation_new/half.h" +#include "tests/validation/Helpers.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/CPP/Utils.h b/tests/validation/CPP/Utils.h index 4e3deb4d86..5e9ec822a5 100644 --- a/tests/validation_new/CPP/Utils.h +++ b/tests/validation/CPP/Utils.h @@ -28,8 +28,6 @@ #include "tests/Globals.h" #include "tests/ILutAccessor.h" #include "tests/Types.h" -#include "tests/validation/ValidationUserConfiguration.h" -#include "tests/validation/half.h" #include <array> #include <random> diff --git a/tests/validation/FixedPoint.h b/tests/validation/FixedPoint.h index 12ffcdfc3d..9691e2a037 100644 --- a/tests/validation/FixedPoint.h +++ b/tests/validation/FixedPoint.h @@ -24,8 +24,8 @@ #ifndef __ARM_COMPUTE_TEST_VALIDATION_FIXEDPOINT_H__ #define __ARM_COMPUTE_TEST_VALIDATION_FIXEDPOINT_H__ -#include "Utils.h" #include "support/ToolchainSupport.h" +#include "tests/Utils.h" #include <cassert> #include <cstdint> @@ -63,6 +63,8 @@ template <> struct promote<uint32_t> { using type = uint64_t; }; template <> struct promote<int32_t> { using type = int64_t; }; template <> struct promote<uint64_t> { using type = uint64_t; }; template <> struct promote<int64_t> { using type = int64_t; }; +template <typename T> +using promote_t = typename promote<T>::type; // clang-format on // *INDENT-ON* } @@ -88,10 +90,6 @@ public: // Static Checks static_assert(std::is_integral<T>::value, "Type is not an integer"); - // Friends - friend struct detail::functions; - friend struct detail::constant_expr<T>; - /** Constructor (from different fixed point type) * * @param[in] val Fixed point @@ -387,7 +385,7 @@ struct functions template <typename T> static bool signbit(fixed_point<T> x) { - return ((x._value >> std::numeric_limits<T>::digits) != 0); + return ((x.raw() >> std::numeric_limits<T>::digits) != 0); } /** Checks if two fixed point numbers are equal * @@ -399,10 +397,10 @@ struct functions template <typename T> static bool isequal(fixed_point<T> x, fixed_point<T> y) { - uint8_t p = std::min(x._fixed_point_position, y._fixed_point_position); + uint8_t p = std::min(x.precision(), y.precision()); x.rescale(p); y.rescale(p); - return (x._value == y._value); + return (x.raw() == y.raw()); } /** Checks if two fixed point number are not equal * @@ -426,10 +424,10 @@ struct functions template <typename T> static bool isgreater(fixed_point<T> x, fixed_point<T> y) { - uint8_t p = std::min(x._fixed_point_position, y._fixed_point_position); + uint8_t p = std::min(x.precision(), y.precision()); x.rescale(p); y.rescale(p); - return (x._value > y._value); + return (x.raw() > y.raw()); } /** Checks if one fixed point is greater or equal than the other * @@ -441,10 +439,10 @@ struct functions template <typename T> static bool isgreaterequal(fixed_point<T> x, fixed_point<T> y) { - uint8_t p = std::min(x._fixed_point_position, y._fixed_point_position); + uint8_t p = std::min(x.precision(), y.precision()); x.rescale(p); y.rescale(p); - return (x._value >= y._value); + return (x.raw() >= y.raw()); } /** Checks if one fixed point is less than the other * @@ -456,10 +454,10 @@ struct functions template <typename T> static bool isless(fixed_point<T> x, fixed_point<T> y) { - uint8_t p = std::min(x._fixed_point_position, y._fixed_point_position); + uint8_t p = std::min(x.precision(), y.precision()); x.rescale(p); y.rescale(p); - return (x._value < y._value); + return (x.raw() < y.raw()); } /** Checks if one fixed point is less or equal than the other * @@ -471,10 +469,10 @@ struct functions template <typename T> static bool islessequal(fixed_point<T> x, fixed_point<T> y) { - uint8_t p = std::min(x._fixed_point_position, y._fixed_point_position); + uint8_t p = std::min(x.precision(), y.precision()); x.rescale(p); y.rescale(p); - return (x._value <= y._value); + return (x.raw() <= y.raw()); } /** Checks if one fixed point is less or greater than the other * @@ -499,7 +497,7 @@ struct functions template <typename T> static fixed_point<T> clamp(fixed_point<T> x, T min, T max) { - return fixed_point<T>(constant_expr<T>::clamp(x._value, min, max), x._fixed_point_position, true); + return fixed_point<T>(constant_expr<T>::clamp(x.raw(), min, max), x.precision(), true); } /** Negate number * @@ -511,12 +509,12 @@ struct functions static fixed_point<T> negate(fixed_point<T> x) { using promoted_T = typename traits::promote<T>::type; - promoted_T val = -x._value; + promoted_T val = -x.raw(); if(OP == OverflowPolicy::SATURATE) { val = constant_expr<T>::saturate_cast(val); } - return fixed_point<T>(static_cast<T>(val), x._fixed_point_position, true); + return fixed_point<T>(static_cast<T>(val), x.precision(), true); } /** Perform addition among two fixed point numbers * @@ -528,19 +526,19 @@ struct functions template <OverflowPolicy OP = OverflowPolicy::SATURATE, typename T> static fixed_point<T> add(fixed_point<T> x, fixed_point<T> y) { - uint8_t p = std::min(x._fixed_point_position, y._fixed_point_position); + uint8_t p = std::min(x.precision(), y.precision()); x.rescale(p); y.rescale(p); if(OP == OverflowPolicy::SATURATE) { using type = typename traits::promote<T>::type; - type val = static_cast<type>(x._value) + static_cast<type>(y._value); + type val = static_cast<type>(x.raw()) + static_cast<type>(y.raw()); val = constant_expr<T>::saturate_cast(val); return fixed_point<T>(static_cast<T>(val), p, true); } else { - return fixed_point<T>(x._value + y._value, p, true); + return fixed_point<T>(x.raw() + y.raw(), p, true); } } /** Perform subtraction among two fixed point numbers @@ -553,19 +551,19 @@ struct functions template <OverflowPolicy OP = OverflowPolicy::SATURATE, typename T> static fixed_point<T> sub(fixed_point<T> x, fixed_point<T> y) { - uint8_t p = std::min(x._fixed_point_position, y._fixed_point_position); + uint8_t p = std::min(x.precision(), y.precision()); x.rescale(p); y.rescale(p); if(OP == OverflowPolicy::SATURATE) { using type = typename traits::promote<T>::type; - type val = static_cast<type>(x._value) - static_cast<type>(y._value); + type val = static_cast<type>(x.raw()) - static_cast<type>(y.raw()); val = constant_expr<T>::saturate_cast(val); return fixed_point<T>(static_cast<T>(val), p, true); } else { - return fixed_point<T>(x._value - y._value, p, true); + return fixed_point<T>(x.raw() - y.raw(), p, true); } } /** Perform multiplication among two fixed point numbers @@ -579,10 +577,10 @@ struct functions static fixed_point<T> mul(fixed_point<T> x, fixed_point<T> y) { using promoted_T = typename traits::promote<T>::type; - uint8_t p_min = std::min(x._fixed_point_position, y._fixed_point_position); - uint8_t p_max = std::max(x._fixed_point_position, y._fixed_point_position); + uint8_t p_min = std::min(x.precision(), y.precision()); + uint8_t p_max = std::max(x.precision(), y.precision()); promoted_T round_factor = (1 << (p_max - 1)); - promoted_T val = ((static_cast<promoted_T>(x._value) * static_cast<promoted_T>(y._value)) + round_factor) >> p_max; + promoted_T val = ((static_cast<promoted_T>(x.raw()) * static_cast<promoted_T>(y.raw())) + round_factor) >> p_max; if(OP == OverflowPolicy::SATURATE) { val = constant_expr<T>::saturate_cast(val); @@ -600,11 +598,11 @@ struct functions static fixed_point<T> div(fixed_point<T> x, fixed_point<T> y) { using promoted_T = typename traits::promote<T>::type; - uint8_t p = std::min(x._fixed_point_position, y._fixed_point_position); - promoted_T denom = static_cast<promoted_T>(y._value); + uint8_t p = std::min(x.precision(), y.precision()); + promoted_T denom = static_cast<promoted_T>(y.raw()); if(denom != 0) { - promoted_T val = (static_cast<promoted_T>(x._value) << std::max(x._fixed_point_position, y._fixed_point_position)) / denom; + promoted_T val = (static_cast<promoted_T>(x.raw()) << std::max(x.precision(), y.precision())) / denom; if(OP == OverflowPolicy::SATURATE) { val = constant_expr<T>::saturate_cast(val); @@ -613,7 +611,7 @@ struct functions } else { - T val = (x._value < 0) ? std::numeric_limits<T>::min() : std::numeric_limits<T>::max(); + T val = (x.raw() < 0) ? std::numeric_limits<T>::min() : std::numeric_limits<T>::max(); return fixed_point<T>(val, p, true); } } @@ -628,12 +626,12 @@ struct functions static fixed_point<T> shift_left(fixed_point<T> x, size_t shift) { using promoted_T = typename traits::promote<T>::type; - promoted_T val = static_cast<promoted_T>(x._value) << shift; + promoted_T val = static_cast<promoted_T>(x.raw()) << shift; if(OP == OverflowPolicy::SATURATE) { val = constant_expr<T>::saturate_cast(val); } - return fixed_point<T>(static_cast<T>(val), x._fixed_point_position, true); + return fixed_point<T>(static_cast<T>(val), x.precision(), true); } /** Shift right * @@ -645,7 +643,7 @@ struct functions template <typename T> static fixed_point<T> shift_right(fixed_point<T> x, size_t shift) { - return fixed_point<T>(x._value >> shift, x._fixed_point_position, true); + return fixed_point<T>(x.raw() >> shift, x.precision(), true); } /** Calculate absolute value * @@ -657,8 +655,8 @@ struct functions static fixed_point<T> abs(fixed_point<T> x) { using promoted_T = typename traits::promote<T>::type; - T val = (x._value < 0) ? constant_expr<T>::saturate_cast(-static_cast<promoted_T>(x._value)) : x._value; - return fixed_point<T>(val, x._fixed_point_position, true); + T val = (x.raw() < 0) ? constant_expr<T>::saturate_cast(-static_cast<promoted_T>(x.raw())) : x.raw(); + return fixed_point<T>(val, x.precision(), true); } /** Calculate the logarithm of a fixed point number * @@ -669,7 +667,7 @@ struct functions template <typename T> static fixed_point<T> log(fixed_point<T> x) { - uint8_t p = x._fixed_point_position; + uint8_t p = x.precision(); auto const_one = fixed_point<T>(static_cast<T>(1), p); // Logarithm of 1 is zero and logarithm of negative values is not defined in R, so return 0. @@ -684,7 +682,7 @@ struct functions } // Remove even powers of 2 - T shift_val = 31 - __builtin_clz(x._value >> p); + T shift_val = 31 - __builtin_clz(x.raw() >> p); x = shift_right(x, shift_val); x = sub(x, const_one); @@ -716,7 +714,7 @@ struct functions template <typename T> static fixed_point<T> exp(fixed_point<T> x) { - uint8_t p = x._fixed_point_position; + uint8_t p = x.precision(); // Constants auto const_one = fixed_point<T>(1, p); auto ln2 = fixed_point<T>(0.6931471, p); @@ -726,7 +724,7 @@ struct functions auto C = fixed_point<T>(0.1763723, p); auto D = fixed_point<T>(0.0435108, p); - T scaled_int_part = detail::constant_expr<T>::to_int(mul(x, inv_ln2)._value, p); + T scaled_int_part = detail::constant_expr<T>::to_int(mul(x, inv_ln2).raw(), p); // Polynomial expansion auto frac_part = sub(x, mul(ln2, fixed_point<T>(scaled_int_part, p))); @@ -753,8 +751,8 @@ struct functions template <typename T> static fixed_point<T> inv_sqrt(fixed_point<T> x) { - const uint8_t p = x._fixed_point_position; - int8_t shift = std::numeric_limits<T>::digits - (p + detail::clz(x._value)); + const uint8_t p = x.precision(); + int8_t shift = std::numeric_limits<T>::digits - (p + detail::clz(x.raw())); shift += std::numeric_limits<T>::is_signed ? 1 : 0; @@ -784,7 +782,7 @@ struct functions template <typename T> static fixed_point<T> tanh(fixed_point<T> x) { - uint8_t p = x._fixed_point_position; + uint8_t p = x.precision(); // Constants auto const_one = fixed_point<T>(1, p); auto const_two = fixed_point<T>(2, p); diff --git a/tests/validation_new/Helpers.cpp b/tests/validation/Helpers.cpp index c65966b06f..d3bcbbd9e4 100644 --- a/tests/validation_new/Helpers.cpp +++ b/tests/validation/Helpers.cpp @@ -21,7 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "tests/validation_new/Helpers.h" +#include "tests/validation/Helpers.h" namespace arm_compute { diff --git a/tests/validation/Helpers.h b/tests/validation/Helpers.h index 19a0c4105c..30959161bb 100644 --- a/tests/validation/Helpers.h +++ b/tests/validation/Helpers.h @@ -25,18 +25,12 @@ #define __ARM_COMPUTE_TEST_VALIDATION_HELPERS_H__ #include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/ILutAccessor.h" -#include "tests/Types.h" -#include "tests/validation/ValidationUserConfiguration.h" +#include "arm_compute/core/Utils.h" #include "tests/validation/half.h" -#include <array> -#include <cstring> #include <random> #include <type_traits> #include <utility> -#include <vector> namespace arm_compute { @@ -44,158 +38,95 @@ namespace test { namespace validation { -/** Helper function to fill one or more tensors with the uniform distribution with int values. - * - * @param[in] dist Distribution to be used to get the values for the tensor. - * @param[in] seeds List of seeds to be used to fill each tensor. - * @param[in,out] tensor Tensor to be initialized with the values of the distribution. - * @param[in,out] other_tensors (Optional) One or more tensors to be filled. - * - */ -template <typename D, typename T, typename... Ts> -void fill_tensors(D &&dist, std::initializer_list<int> seeds, T &&tensor, Ts &&... other_tensors) +template <typename T> +struct is_floating_point : public std::is_floating_point<T> { - const std::array < T, 1 + sizeof...(Ts) > tensors{ { std::forward<T>(tensor), std::forward<Ts>(other_tensors)... } }; - std::vector<int> vs(seeds); - ARM_COMPUTE_ERROR_ON(vs.size() != tensors.size()); - int k = 0; - for(auto tp : tensors) - { - library->fill(*tp, std::forward<D>(dist), vs[k++]); - } -} +}; + +template <> +struct is_floating_point<half_float::half> : public std::true_type +{ +}; /** Helper function to get the testing range for each activation layer. * * @param[in] activation Activation function to test. - * @param[in] fixed_point_position (Optional) Number of bits for the fractional part. Defaults to 1. + * @param[in] data_type Data type. + * @param[in] fixed_point_position Number of bits for the fractional part. Defaults to 1. * * @return A pair containing the lower upper testing bounds for a given function. */ template <typename T> -inline std::pair<T, T> get_activation_layer_test_bounds(ActivationLayerInfo::ActivationFunction activation, int fixed_point_position = 1) +std::pair<T, T> get_activation_layer_test_bounds(ActivationLayerInfo::ActivationFunction activation, DataType data_type, int fixed_point_position = 0) { - bool is_float = std::is_same<T, float>::value; - is_float = is_float || std::is_same<T, half_float::half>::value; - std::pair<T, T> bounds; - // Set initial values - if(is_float) - { - bounds = std::make_pair(-255.f, 255.f); - } - else + switch(data_type) { - bounds = std::make_pair(std::numeric_limits<T>::lowest(), std::numeric_limits<T>::max()); - } + case DataType::F16: + { + using namespace half_float::literal; - // Reduce testing ranges - switch(activation) - { - case ActivationLayerInfo::ActivationFunction::LOGISTIC: - case ActivationLayerInfo::ActivationFunction::SOFT_RELU: - // Reduce range as exponent overflows - if(is_float) + switch(activation) { - bounds.first = -40.f; - bounds.second = 40.f; - } - else - { - bounds.first = -(1 << (fixed_point_position)); - bounds.second = 1 << (fixed_point_position); + case ActivationLayerInfo::ActivationFunction::SQUARE: + case ActivationLayerInfo::ActivationFunction::LOGISTIC: + case ActivationLayerInfo::ActivationFunction::SOFT_RELU: + // Reduce range as exponent overflows + bounds = std::make_pair(-10._h, 10._h); + break; + case ActivationLayerInfo::ActivationFunction::SQRT: + // Reduce range as sqrt should take a non-negative number + bounds = std::make_pair(0._h, 255._h); + break; + default: + bounds = std::make_pair(-255._h, 255._h); + break; } break; - case ActivationLayerInfo::ActivationFunction::TANH: - // Reduce range as exponent overflows - if(!is_float) + } + case DataType::F32: + switch(activation) { - bounds.first = -(1 << (fixed_point_position)); - bounds.second = 1 << (fixed_point_position); + case ActivationLayerInfo::ActivationFunction::LOGISTIC: + case ActivationLayerInfo::ActivationFunction::SOFT_RELU: + // Reduce range as exponent overflows + bounds = std::make_pair(-40.f, 40.f); + break; + case ActivationLayerInfo::ActivationFunction::SQRT: + // Reduce range as sqrt should take a non-negative number + bounds = std::make_pair(0.f, 255.f); + break; + default: + bounds = std::make_pair(-255.f, 255.f); + break; } break; - case ActivationLayerInfo::ActivationFunction::SQRT: - // Reduce range as sqrt should take a non-negative number - bounds.first = (is_float) ? 0 : 1; - break; - default: - break; - } - return bounds; -} -/** Helper function to get the testing range for batch normalization layer. - * - * @param[in] fixed_point_position (Optional) Number of bits for the fractional part. Defaults to 1. - * - * @return A pair containing the lower upper testing bounds. - */ -template <typename T> -std::pair<T, T> get_batchnormalization_layer_test_bounds(int fixed_point_position = 1) -{ - bool is_float = std::is_floating_point<T>::value; - std::pair<T, T> bounds; - - // Set initial values - if(is_float) - { - bounds = std::make_pair(-1.f, 1.f); - } - else - { - bounds = std::make_pair(1, 1 << (fixed_point_position)); - } - - return bounds; -} - -/** Fill mask with the corresponding given pattern. - * - * @param[in,out] mask Mask to be filled according to pattern - * @param[in] cols Columns (width) of mask - * @param[in] rows Rows (height) of mask - * @param[in] pattern Pattern to fill the mask according to - */ -inline void fill_mask_from_pattern(uint8_t *mask, int cols, int rows, MatrixPattern pattern) -{ - unsigned int v = 0; - std::mt19937 gen(user_config.seed.get()); - std::bernoulli_distribution dist(0.5); - - for(int r = 0; r < rows; ++r) - { - for(int c = 0; c < cols; ++c, ++v) - { - uint8_t val = 0; - - switch(pattern) + case DataType::QS8: + case DataType::QS16: + switch(activation) { - case MatrixPattern::BOX: - val = 255; - break; - case MatrixPattern::CROSS: - val = ((r == (rows / 2)) || (c == (cols / 2))) ? 255 : 0; - break; - case MatrixPattern::DISK: - val = (((r - rows / 2.0f + 0.5f) * (r - rows / 2.0f + 0.5f)) / ((rows / 2.0f) * (rows / 2.0f)) + ((c - cols / 2.0f + 0.5f) * (c - cols / 2.0f + 0.5f)) / ((cols / 2.0f) * - (cols / 2.0f))) <= 1.0f ? 255 : 0; + case ActivationLayerInfo::ActivationFunction::LOGISTIC: + case ActivationLayerInfo::ActivationFunction::SOFT_RELU: + case ActivationLayerInfo::ActivationFunction::TANH: + // Reduce range as exponent overflows + bounds = std::make_pair(-(1 << fixed_point_position), 1 << fixed_point_position); break; - case MatrixPattern::OTHER: - val = (dist(gen) ? 0 : 255); + case ActivationLayerInfo::ActivationFunction::SQRT: + // Reduce range as sqrt should take a non-negative number + // Can't be zero either as inv_sqrt is used in NEON. + bounds = std::make_pair(1, std::numeric_limits<T>::max()); break; default: - return; + bounds = std::make_pair(std::numeric_limits<T>::lowest(), std::numeric_limits<T>::max()); + break; } - - mask[v] = val; - } + break; + default: + ARM_COMPUTE_ERROR("Unsupported data type"); } - if(pattern == MatrixPattern::OTHER) - { - std::uniform_int_distribution<uint8_t> distribution_u8(0, ((cols * rows) - 1)); - mask[distribution_u8(gen)] = 255; - } + return bounds; } /** Calculate output tensor shape give a vector of input tensor to concatenate @@ -204,69 +135,7 @@ inline void fill_mask_from_pattern(uint8_t *mask, int cols, int rows, MatrixPatt * * @return The shape of output concatenated tensor. */ -inline TensorShape calculate_depth_concatenate_shape(std::vector<TensorShape> input_shapes) -{ - TensorShape out_shape = input_shapes.at(0); - - unsigned int max_x = 0; - unsigned int max_y = 0; - unsigned int depth = 0; - - for(auto const &shape : input_shapes) - { - max_x = std::max<unsigned int>(shape.x(), max_x); - max_y = std::max<unsigned int>(shape.y(), max_y); - depth += shape.z(); - } - - out_shape.set(0, max_x); - out_shape.set(1, max_y); - out_shape.set(2, depth); - - return out_shape; -} - -/** Fill matrix random. - * - * @param[in,out] matrix Matrix - * @param[in] cols Columns (width) of matrix - * @param[in] rows Rows (height) of matrix - */ -template <std::size_t SIZE> -inline void fill_warp_matrix(std::array<float, SIZE> &matrix, int cols, int rows) -{ - std::mt19937 gen(user_config.seed.get()); - std::uniform_real_distribution<float> dist(-1, 1); - - for(int v = 0, r = 0; r < rows; ++r) - { - for(int c = 0; c < cols; ++c, ++v) - { - matrix[v] = dist(gen); - } - } - if(SIZE == 9) - { - matrix[(cols * rows) - 1] = 1; - } -} - -/** Helper function to fill the Lut random by a ILutAccessor. - * - * @param[in,out] table Accessor at the Lut. - * - */ -template <typename T> -void fill_lookuptable(T &&table) -{ - std::mt19937 generator(user_config.seed.get()); - std::uniform_int_distribution<typename T::value_type> distribution(std::numeric_limits<typename T::value_type>::min(), std::numeric_limits<typename T::value_type>::max()); - - for(int i = std::numeric_limits<typename T::value_type>::min(); i <= std::numeric_limits<typename T::value_type>::max(); i++) - { - table[i] = distribution(generator); - } -} +TensorShape calculate_depth_concatenate_shape(const std::vector<TensorShape> &input_shapes); } // namespace validation } // namespace test } // namespace arm_compute diff --git a/tests/validation_new/NEON/ActivationLayer.cpp b/tests/validation/NEON/ActivationLayer.cpp index bc2fe603fd..1c6811fd1c 100644 --- a/tests/validation_new/NEON/ActivationLayer.cpp +++ b/tests/validation/NEON/ActivationLayer.cpp @@ -25,16 +25,16 @@ #include "arm_compute/runtime/NEON/functions/NEActivationLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ActivationFunctionsDataset.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/ActivationLayerFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/ActivationFunctionsDataset.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/ActivationLayerFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/BitwiseAnd.cpp b/tests/validation/NEON/BitwiseAnd.cpp index 5e6f9000e2..179413ee39 100644 --- a/tests/validation_new/NEON/BitwiseAnd.cpp +++ b/tests/validation/NEON/BitwiseAnd.cpp @@ -25,14 +25,14 @@ #include "arm_compute/runtime/NEON/functions/NEBitwiseAnd.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/BitwiseAndFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/BitwiseAndFixture.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/BitwiseNot.cpp b/tests/validation/NEON/BitwiseNot.cpp index 3725379404..c438a5700b 100644 --- a/tests/validation_new/NEON/BitwiseNot.cpp +++ b/tests/validation/NEON/BitwiseNot.cpp @@ -25,14 +25,14 @@ #include "arm_compute/runtime/NEON/functions/NEBitwiseNot.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/BitwiseNotFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/BitwiseNotFixture.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/BitwiseOr.cpp b/tests/validation/NEON/BitwiseOr.cpp index 84ddf8ea47..0e4cdbe2c1 100644 --- a/tests/validation_new/NEON/BitwiseOr.cpp +++ b/tests/validation/NEON/BitwiseOr.cpp @@ -25,14 +25,14 @@ #include "arm_compute/runtime/NEON/functions/NEBitwiseOr.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/BitwiseOrFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/BitwiseOrFixture.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/BitwiseXor.cpp b/tests/validation/NEON/BitwiseXor.cpp index 5a5a650295..70363c041b 100644 --- a/tests/validation_new/NEON/BitwiseXor.cpp +++ b/tests/validation/NEON/BitwiseXor.cpp @@ -25,14 +25,14 @@ #include "arm_compute/runtime/NEON/functions/NEBitwiseXor.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/BitwiseXorFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/BitwiseXorFixture.h" namespace arm_compute { diff --git a/tests/validation/NEON/CMakeLists.txt b/tests/validation/NEON/CMakeLists.txt deleted file mode 100644 index bf07d27d6a..0000000000 --- a/tests/validation/NEON/CMakeLists.txt +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright (c) 2017 ARM Limited. -# -# SPDX-License-Identifier: MIT -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -cmake_minimum_required (VERSION 3.1) - -set(arm_compute_test_validation_NEON_SOURCE_FILES - ${CMAKE_SOURCE_DIR}/NEON/Helper.h - ${CMAKE_SOURCE_DIR}/NEON/Accessor.h - ${CMAKE_CURRENT_SOURCE_DIR}/AbsoluteDifference.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Accumulate.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/AccumulateSquared.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/AccumulateWeighted.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/ArithmeticAddition.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/ArithmeticSubtraction.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/BatchNormalizationLayer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/BitwiseAnd.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/BitwiseNot.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/BitwiseOr.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/BitwiseXor.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Box3x3.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/ConvolutionLayer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/DirectConvolutionLayer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/DepthConvert.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/FillBorder.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Fixedpoint/Exp_QS8.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Fixedpoint/Invsqrt_QS8.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Fixedpoint/Log_QS8.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Fixedpoint/Reciprocal_QS8.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/FullyConnectedLayer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Gaussian3x3.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/GEMM.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/HarrisCorners.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/IntegralImage.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/NormalizationLayer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/PixelWiseMultiplication.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/MeanStdDev.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Pooling/PoolingLayer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Sobel3x3.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Sobel5x5.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/SoftmaxLayer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Threshold.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/MinMaxLocation.cpp -) - -add_library(arm_compute_test_validation_NEON OBJECT - ${arm_compute_test_validation_NEON_SOURCE_FILES} -) - -set(arm_compute_test_validation_TARGET_OBJECTS - ${arm_compute_test_validation_TARGET_OBJECTS} - $<TARGET_OBJECTS:arm_compute_test_validation_NEON> - PARENT_SCOPE -) diff --git a/tests/validation_new/NEON/ConvolutionLayer.cpp b/tests/validation/NEON/ConvolutionLayer.cpp index 1efff02428..7a3306d232 100644 --- a/tests/validation_new/NEON/ConvolutionLayer.cpp +++ b/tests/validation/NEON/ConvolutionLayer.cpp @@ -25,16 +25,16 @@ #include "arm_compute/runtime/NEON/functions/NEConvolutionLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/LargeConvolutionLayerDataset.h" -#include "tests/datasets_new/SmallConvolutionLayerDataset.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/ConvolutionLayerFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/LargeConvolutionLayerDataset.h" +#include "tests/datasets/SmallConvolutionLayerDataset.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/ConvolutionLayerFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/DepthConcatenateLayer.cpp b/tests/validation/NEON/DepthConcatenateLayer.cpp index d6400d2df5..19a41ee9d6 100644 --- a/tests/validation_new/NEON/DepthConcatenateLayer.cpp +++ b/tests/validation/NEON/DepthConcatenateLayer.cpp @@ -25,14 +25,14 @@ #include "arm_compute/runtime/NEON/functions/NEDepthConcatenate.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/DepthConcatenateLayerFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/DepthConcatenateLayerFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/DequantizationLayer.cpp b/tests/validation/NEON/DequantizationLayer.cpp index 8b67a14d12..22d56ab5d8 100644 --- a/tests/validation_new/NEON/DequantizationLayer.cpp +++ b/tests/validation/NEON/DequantizationLayer.cpp @@ -25,14 +25,14 @@ #include "arm_compute/runtime/NEON/functions/NEDequantizationLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/DequantizationLayerFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/DequantizationLayerFixture.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/DirectConvolutionLayer.cpp b/tests/validation/NEON/DirectConvolutionLayer.cpp index 68cbe54b32..6211d31c45 100644 --- a/tests/validation_new/NEON/DirectConvolutionLayer.cpp +++ b/tests/validation/NEON/DirectConvolutionLayer.cpp @@ -25,15 +25,15 @@ #include "arm_compute/runtime/NEON/functions/NEDirectConvolutionLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/DirectConvolutionLayerFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/DirectConvolutionLayerFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/Floor.cpp b/tests/validation/NEON/Floor.cpp index e100c3035b..ea16e0b21e 100644 --- a/tests/validation_new/NEON/Floor.cpp +++ b/tests/validation/NEON/Floor.cpp @@ -25,14 +25,14 @@ #include "arm_compute/runtime/NEON/functions/NEFloor.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/FloorFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/FloorFixture.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/FullyConnectedLayer.cpp b/tests/validation/NEON/FullyConnectedLayer.cpp index e859fb3872..55f8da97cf 100644 --- a/tests/validation_new/NEON/FullyConnectedLayer.cpp +++ b/tests/validation/NEON/FullyConnectedLayer.cpp @@ -25,15 +25,15 @@ #include "arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/FullyConnectedLayerDataset.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/FullyConnectedLayerFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/FullyConnectedLayerDataset.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/FullyConnectedLayerFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/GEMM.cpp b/tests/validation/NEON/GEMM.cpp index 453b183d1e..05db3bbd6d 100644 --- a/tests/validation_new/NEON/GEMM.cpp +++ b/tests/validation/NEON/GEMM.cpp @@ -25,16 +25,16 @@ #include "arm_compute/runtime/NEON/functions/NEGEMM.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/LargeGEMMDataset.h" -#include "tests/datasets_new/SmallGEMMDataset.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/GEMMFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/LargeGEMMDataset.h" +#include "tests/datasets/SmallGEMMDataset.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/GEMMFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/L2Normalize.cpp b/tests/validation/NEON/L2Normalize.cpp index 20804d2a94..4f94c15767 100644 --- a/tests/validation_new/NEON/L2Normalize.cpp +++ b/tests/validation/NEON/L2Normalize.cpp @@ -25,14 +25,14 @@ #include "arm_compute/runtime/NEON/functions/NEL2Normalize.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/L2NormalizeFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/L2NormalizeFixture.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/MeanStdDev.cpp b/tests/validation/NEON/MeanStdDev.cpp index 6214261afb..42d887960e 100644 --- a/tests/validation_new/NEON/MeanStdDev.cpp +++ b/tests/validation/NEON/MeanStdDev.cpp @@ -22,12 +22,12 @@ * SOFTWARE. */ #include "arm_compute/runtime/NEON/functions/NEMeanStdDev.h" -#include "framework/Macros.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/MeanStdDevFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Macros.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/MeanStdDevFixture.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/NormalizationLayer.cpp b/tests/validation/NEON/NormalizationLayer.cpp index 1da2ed0874..5d792e9e09 100644 --- a/tests/validation_new/NEON/NormalizationLayer.cpp +++ b/tests/validation/NEON/NormalizationLayer.cpp @@ -25,16 +25,16 @@ #include "arm_compute/runtime/NEON/functions/NENormalizationLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/NormalizationTypesDataset.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/NormalizationLayerFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/NormalizationTypesDataset.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/NormalizationLayerFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/PoolingLayer.cpp b/tests/validation/NEON/PoolingLayer.cpp index 20fce3d73a..ac5a28b527 100644 --- a/tests/validation_new/NEON/PoolingLayer.cpp +++ b/tests/validation/NEON/PoolingLayer.cpp @@ -25,16 +25,16 @@ #include "arm_compute/runtime/NEON/functions/NEPoolingLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/PoolingTypesDataset.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/PoolingLayerFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/PoolingTypesDataset.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/PoolingLayerFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/QuantizationLayer.cpp b/tests/validation/NEON/QuantizationLayer.cpp index 8b2acd6331..5c2fab4653 100644 --- a/tests/validation_new/NEON/QuantizationLayer.cpp +++ b/tests/validation/NEON/QuantizationLayer.cpp @@ -25,14 +25,14 @@ #include "arm_compute/runtime/NEON/functions/NEQuantizationLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/QuantizationLayerFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/QuantizationLayerFixture.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/ReductionOperation.cpp b/tests/validation/NEON/ReductionOperation.cpp index 4048af09e7..4ea71a6336 100644 --- a/tests/validation_new/NEON/ReductionOperation.cpp +++ b/tests/validation/NEON/ReductionOperation.cpp @@ -25,15 +25,15 @@ #include "arm_compute/runtime/NEON/functions/NEReductionOperation.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ReductionOperationDataset.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/ReductionOperationFixture.h" +#include "tests/datasets/ReductionOperationDataset.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/ReductionOperationFixture.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/Scale.cpp b/tests/validation/NEON/Scale.cpp index 1036f98c23..2fbd7c7014 100644 --- a/tests/validation_new/NEON/Scale.cpp +++ b/tests/validation/NEON/Scale.cpp @@ -26,17 +26,17 @@ #include "arm_compute/runtime/NEON/functions/NEScale.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/BorderModeDataset.h" -#include "tests/datasets_new/InterpolationPolicyDataset.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Helpers.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/ScaleFixture.h" +#include "tests/datasets/BorderModeDataset.h" +#include "tests/datasets/InterpolationPolicyDataset.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Helpers.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/ScaleFixture.h" namespace arm_compute { diff --git a/tests/validation_new/NEON/SoftmaxLayer.cpp b/tests/validation/NEON/SoftmaxLayer.cpp index 337ee29986..36f1881147 100644 --- a/tests/validation_new/NEON/SoftmaxLayer.cpp +++ b/tests/validation/NEON/SoftmaxLayer.cpp @@ -25,15 +25,15 @@ #include "arm_compute/runtime/NEON/functions/NESoftmaxLayer.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "framework/Asserts.h" -#include "framework/Macros.h" -#include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" -#include "tests/datasets_new/ShapeDatasets.h" -#include "tests/validation_new/Validation.h" -#include "tests/validation_new/fixtures/SoftmaxLayerFixture.h" -#include "tests/validation_new/half.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "tests/validation/Validation.h" +#include "tests/validation/fixtures/SoftmaxLayerFixture.h" +#include "tests/validation/half.h" namespace arm_compute { diff --git a/tests/validation/UNIT/CMakeLists.txt b/tests/validation/UNIT/CMakeLists.txt deleted file mode 100644 index a0603f150c..0000000000 --- a/tests/validation/UNIT/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) 2017 ARM Limited. -# -# SPDX-License-Identifier: MIT -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -cmake_minimum_required (VERSION 3.1) - -set(arm_compute_test_validation_UNIT_SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/TensorInfo.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/Utils.cpp -) - -add_library(arm_compute_test_validation_UNIT OBJECT - ${arm_compute_test_validation_UNIT_SOURCE_FILES} -) - -set(arm_compute_test_validation_TARGET_OBJECTS - ${arm_compute_test_validation_TARGET_OBJECTS} - $<TARGET_OBJECTS:arm_compute_test_validation_UNIT> - PARENT_SCOPE -) diff --git a/tests/validation/Validation.cpp b/tests/validation/Validation.cpp index d321e63d77..fec7c10939 100644 --- a/tests/validation/Validation.cpp +++ b/tests/validation/Validation.cpp @@ -25,22 +25,14 @@ #include "arm_compute/core/Coordinates.h" #include "arm_compute/core/Error.h" -#include "arm_compute/core/FixedPoint.h" -#include "arm_compute/core/IArray.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/runtime/Tensor.h" -#include "tests/IAccessor.h" -#include "tests/RawTensor.h" -#include "tests/TypePrinter.h" -#include "tests/Utils.h" #include "tests/validation/half.h" #include <array> #include <cmath> #include <cstddef> #include <cstdint> -#include <iomanip> -#include <vector> namespace arm_compute { @@ -99,39 +91,6 @@ double get_double_data(const void *ptr, DataType data_type) } } -bool is_equal(double target, double ref, double max_absolute_error = std::numeric_limits<double>::epsilon(), double max_relative_error = 0.0001f) -{ - if(!std::isfinite(target) || !std::isfinite(ref)) - { - return false; - } - - // No need further check if they are equal - if(ref == target) - { - return true; - } - - // Need this check for the situation when the two values close to zero but have different sign - if(std::abs(std::abs(ref) - std::abs(target)) <= max_absolute_error) - { - return true; - } - - double relative_error = 0; - - if(std::abs(target) > std::abs(ref)) - { - relative_error = std::abs((target - ref) / target); - } - else - { - relative_error = std::abs((ref - target) / ref); - } - - return relative_error <= max_relative_error; -} - void check_border_element(const IAccessor &tensor, const Coordinates &id, const BorderMode &border_mode, const void *border_value, int64_t &num_elements, int64_t &num_mismatches) @@ -142,61 +101,46 @@ void check_border_element(const IAccessor &tensor, const Coordinates &id, if(border_mode == BorderMode::REPLICATE) { Coordinates border_id{ id }; - border_id.set(1, 0); - border_value = tensor(border_id); - } - // Iterate over all channels within one element - for(int channel = 0; channel < tensor.num_channels(); ++channel) - { - const size_t channel_offset = channel * channel_size; - const double target = get_double_data(ptr + channel_offset, tensor.data_type()); - const double ref = get_double_data(static_cast<const uint8_t *>(border_value) + channel_offset, tensor.data_type()); - const bool equal = is_equal(target, ref); - - BOOST_TEST_INFO("id = " << id); - BOOST_TEST_INFO("channel = " << channel); - BOOST_TEST_INFO("reference = " << std::setprecision(5) << ref); - BOOST_TEST_INFO("target = " << std::setprecision(5) << target); - BOOST_TEST_WARN(equal); + if(id.x() < 0) + { + border_id.set(0, 0); + } + else if(static_cast<size_t>(id.x()) >= tensor.shape().x()) + { + border_id.set(0, tensor.shape().x() - 1); + } - if(!equal) + if(id.y() < 0) { - ++num_mismatches; + border_id.set(1, 0); + } + else if(static_cast<size_t>(id.y()) >= tensor.shape().y()) + { + border_id.set(1, tensor.shape().y() - 1); } - ++num_elements; + border_value = tensor(border_id); } -} - -void check_single_element(const Coordinates &id, const IAccessor &tensor, const RawTensor &reference, float tolerance_value, - uint64_t wrap_range, int min_channels, size_t channel_size, int64_t &num_mismatches, int64_t &num_elements) -{ - const auto ptr = static_cast<const uint8_t *>(tensor(id)); - const auto ref_ptr = static_cast<const uint8_t *>(reference(id)); // Iterate over all channels within one element - for(int channel = 0; channel < min_channels; ++channel) + for(int channel = 0; channel < tensor.num_channels(); ++channel) { const size_t channel_offset = channel * channel_size; - const double target = get_double_data(ptr + channel_offset, reference.data_type()); - const double ref = get_double_data(ref_ptr + channel_offset, reference.data_type()); - bool equal = is_equal(target, ref, tolerance_value); + const double target = get_double_data(ptr + channel_offset, tensor.data_type()); + const double reference = get_double_data(static_cast<const uint8_t *>(border_value) + channel_offset, tensor.data_type()); - if(wrap_range != 0 && !equal) + if(!compare<AbsoluteTolerance<double>, double>(target, reference)) { - equal = is_equal(target, ref, wrap_range - tolerance_value); - } + ARM_COMPUTE_TEST_INFO("id = " << id); + ARM_COMPUTE_TEST_INFO("channel = " << channel); + ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << target); + ARM_COMPUTE_TEST_INFO("reference = " << std::setprecision(5) << reference); + ARM_COMPUTE_EXPECT_EQUAL(target, reference, framework::LogLevel::DEBUG); - if(!equal) - { - BOOST_TEST_INFO("id = " << id); - BOOST_TEST_INFO("channel = " << channel); - BOOST_TEST_INFO("reference = " << std::setprecision(5) << ref); - BOOST_TEST_INFO("target = " << std::setprecision(5) << target); - BOOST_TEST_WARN(equal); ++num_mismatches; } + ++num_elements; } } @@ -204,107 +148,31 @@ void check_single_element(const Coordinates &id, const IAccessor &tensor, const void validate(const arm_compute::ValidRegion ®ion, const arm_compute::ValidRegion &reference) { - BOOST_TEST(region.anchor.num_dimensions() == reference.anchor.num_dimensions()); - BOOST_TEST(region.shape.num_dimensions() == reference.shape.num_dimensions()); + ARM_COMPUTE_EXPECT_EQUAL(region.anchor.num_dimensions(), reference.anchor.num_dimensions(), framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT_EQUAL(region.shape.num_dimensions(), reference.shape.num_dimensions(), framework::LogLevel::ERRORS); for(unsigned int d = 0; d < region.anchor.num_dimensions(); ++d) { - BOOST_TEST(region.anchor[d] == reference.anchor[d]); + ARM_COMPUTE_EXPECT_EQUAL(region.anchor[d], reference.anchor[d], framework::LogLevel::ERRORS); } for(unsigned int d = 0; d < region.shape.num_dimensions(); ++d) { - BOOST_TEST(region.shape[d] == reference.shape[d]); + ARM_COMPUTE_EXPECT_EQUAL(region.shape[d], reference.shape[d], framework::LogLevel::ERRORS); } } void validate(const arm_compute::PaddingSize &padding, const arm_compute::PaddingSize &reference) { - BOOST_TEST(padding.top == reference.top); - BOOST_TEST(padding.right == reference.right); - BOOST_TEST(padding.bottom == reference.bottom); - BOOST_TEST(padding.left == reference.left); -} - -void validate(const IAccessor &tensor, const RawTensor &reference, float tolerance_value, float tolerance_number, uint64_t wrap_range) -{ - // Validate with valid region covering the entire shape - validate(tensor, reference, shape_to_valid_region(tensor.shape()), tolerance_value, tolerance_number, wrap_range); -} - -void validate(const IAccessor &tensor, const RawTensor &reference, const ValidRegion &valid_region, float tolerance_value, float tolerance_number, uint64_t wrap_range) -{ - int64_t num_mismatches = 0; - int64_t num_elements = 0; - - BOOST_TEST(tensor.element_size() == reference.element_size()); - BOOST_TEST(tensor.format() == reference.format()); - BOOST_TEST(tensor.data_type() == reference.data_type()); - BOOST_TEST(tensor.num_channels() == reference.num_channels()); - BOOST_TEST(compare_dimensions(tensor.shape(), reference.shape())); - - const int min_elements = std::min(tensor.num_elements(), reference.num_elements()); - const int min_channels = std::min(tensor.num_channels(), reference.num_channels()); - const size_t channel_size = element_size_from_data_type(reference.data_type()); - - // Iterate over all elements within valid region, e.g. U8, S16, RGB888, ... - for(int element_idx = 0; element_idx < min_elements; ++element_idx) - { - const Coordinates id = index2coord(reference.shape(), element_idx); - if(is_in_valid_region(valid_region, id)) - { - check_single_element(id, tensor, reference, tolerance_value, wrap_range, min_channels, channel_size, num_mismatches, num_elements); - } - } - - const int64_t absolute_tolerance_number = tolerance_number * num_elements; - const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f; - - BOOST_TEST(num_mismatches <= absolute_tolerance_number, - num_mismatches << " values (" << std::setprecision(2) << percent_mismatches - << "%) mismatched (maximum tolerated " << std::setprecision(2) << tolerance_number << "%)"); -} - -void validate(const IAccessor &tensor, const RawTensor &reference, const RawTensor &valid_mask, float tolerance_value, float tolerance_number, uint64_t wrap_range) -{ - int64_t num_mismatches = 0; - int64_t num_elements = 0; - - BOOST_TEST(tensor.element_size() == reference.element_size()); - BOOST_TEST(tensor.format() == reference.format()); - BOOST_TEST(tensor.data_type() == reference.data_type()); - BOOST_TEST(tensor.num_channels() == reference.num_channels()); - BOOST_TEST(compare_dimensions(tensor.shape(), reference.shape())); - - const int min_elements = std::min(tensor.num_elements(), reference.num_elements()); - const int min_channels = std::min(tensor.num_channels(), reference.num_channels()); - const size_t channel_size = element_size_from_data_type(reference.data_type()); - - // Iterate over all elements within valid region, e.g. U8, S16, RGB888, ... - for(int element_idx = 0; element_idx < min_elements; ++element_idx) - { - const Coordinates id = index2coord(reference.shape(), element_idx); - if(valid_mask[element_idx] == 1) - { - check_single_element(id, tensor, reference, tolerance_value, wrap_range, min_channels, channel_size, num_mismatches, num_elements); - } - else - { - ++num_elements; - } - } - - const int64_t absolute_tolerance_number = tolerance_number * num_elements; - const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f; - - BOOST_TEST(num_mismatches <= absolute_tolerance_number, - num_mismatches << " values (" << std::setprecision(2) << percent_mismatches - << "%) mismatched (maximum tolerated " << std::setprecision(2) << tolerance_number << "%)"); + ARM_COMPUTE_EXPECT_EQUAL(padding.top, reference.top, framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT_EQUAL(padding.right, reference.right, framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT_EQUAL(padding.bottom, reference.bottom, framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT_EQUAL(padding.left, reference.left, framework::LogLevel::ERRORS); } void validate(const IAccessor &tensor, const void *reference_value) { - BOOST_TEST_REQUIRE((reference_value != nullptr)); + ARM_COMPUTE_ASSERT(reference_value != nullptr); int64_t num_mismatches = 0; int64_t num_elements = 0; @@ -322,17 +190,16 @@ void validate(const IAccessor &tensor, const void *reference_value) { const size_t channel_offset = channel * channel_size; const double target = get_double_data(ptr + channel_offset, tensor.data_type()); - const double ref = get_double_data(reference_value, tensor.data_type()); - const bool equal = is_equal(target, ref); - - BOOST_TEST_INFO("id = " << id); - BOOST_TEST_INFO("channel = " << channel); - BOOST_TEST_INFO("reference = " << std::setprecision(5) << ref); - BOOST_TEST_INFO("target = " << std::setprecision(5) << target); - BOOST_TEST_WARN(equal); + const double reference = get_double_data(reference_value, tensor.data_type()); - if(!equal) + if(!compare<AbsoluteTolerance<double>, double>(target, reference)) { + ARM_COMPUTE_TEST_INFO("id = " << id); + ARM_COMPUTE_TEST_INFO("channel = " << channel); + ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << target); + ARM_COMPUTE_TEST_INFO("reference = " << std::setprecision(5) << reference); + ARM_COMPUTE_EXPECT_EQUAL(target, reference, framework::LogLevel::DEBUG); + ++num_mismatches; } @@ -340,10 +207,13 @@ void validate(const IAccessor &tensor, const void *reference_value) } } - const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f; + if(num_elements > 0) + { + const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f; - BOOST_TEST(num_mismatches == 0, - num_mismatches << " values (" << std::setprecision(2) << percent_mismatches << "%) mismatched"); + ARM_COMPUTE_TEST_INFO(num_mismatches << " values (" << std::fixed << std::setprecision(2) << percent_mismatches << "%) mismatched"); + ARM_COMPUTE_EXPECT_EQUAL(num_mismatches, 0, framework::LogLevel::ERRORS); + } } void validate(const IAccessor &tensor, BorderSize border_size, const BorderMode &border_mode, const void *border_value) @@ -354,7 +224,7 @@ void validate(const IAccessor &tensor, BorderSize border_size, const BorderMode } else if(border_mode == BorderMode::CONSTANT) { - BOOST_TEST((border_value != nullptr)); + ARM_COMPUTE_ASSERT(border_value != nullptr); } int64_t num_mismatches = 0; @@ -414,63 +284,23 @@ void validate(const IAccessor &tensor, BorderSize border_size, const BorderMode } } - const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f; + if(num_elements > 0) + { + const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f; - BOOST_TEST(num_mismatches == 0, - num_mismatches << " values (" << std::setprecision(2) << percent_mismatches << "%) mismatched"); + ARM_COMPUTE_TEST_INFO(num_mismatches << " values (" << std::fixed << std::setprecision(2) << percent_mismatches << "%) mismatched"); + ARM_COMPUTE_EXPECT_EQUAL(num_mismatches, 0, framework::LogLevel::ERRORS); + } } void validate(std::vector<unsigned int> classified_labels, std::vector<unsigned int> expected_labels) { - ARM_COMPUTE_UNUSED(classified_labels); - ARM_COMPUTE_UNUSED(expected_labels); - BOOST_TEST(expected_labels.size() != 0); - BOOST_TEST(classified_labels.size() == expected_labels.size()); + ARM_COMPUTE_EXPECT_EQUAL(classified_labels.size(), expected_labels.size(), framework::LogLevel::ERRORS); for(unsigned int i = 0; i < expected_labels.size(); ++i) { - BOOST_TEST(classified_labels[i] == expected_labels[i]); - } -} - -void validate(float target, float ref, float tolerance_abs_error, float tolerance_relative_error) -{ - const bool equal = is_equal(target, ref, tolerance_abs_error, tolerance_relative_error); - - BOOST_TEST_INFO("reference = " << std::setprecision(5) << ref); - BOOST_TEST_INFO("target = " << std::setprecision(5) << target); - BOOST_TEST(equal); -} - -void validate(IArray<KeyPoint> &target, IArray<KeyPoint> &ref, int64_t tolerance) -{ - int64_t num_mismatches = 0; - - BOOST_TEST_WARN(target.num_values() == ref.num_values()); - - for(size_t i = 0; i < target.num_values(); ++i) - { - KeyPoint *ref_val = std::find_if(ref.buffer(), ref.buffer() + ref.num_values(), [&target, i](KeyPoint key) - { - return key.x == target.at(i).x && key.y == target.at(i).y; - }); - - const KeyPoint &key = target.at(i); - - if((ref_val == ref.buffer() + ref.num_values()) || !(is_equal(key.strength, ref_val->strength) && is_equal(key.scale, ref_val->scale) && is_equal(key.orientation, ref_val->orientation) - && is_equal(key.tracking_status, ref_val->tracking_status) && is_equal(key.error, ref_val->error))) - { - ++num_mismatches; - - BOOST_TEST_WARN(is_equal(key.strength, ref_val->strength)); - BOOST_TEST_WARN(is_equal(key.scale, ref_val->scale)); - BOOST_TEST_WARN(is_equal(key.orientation, ref_val->orientation)); - BOOST_TEST_WARN(is_equal(key.tracking_status, ref_val->tracking_status)); - BOOST_TEST_WARN(is_equal(key.error, ref_val->error)); - } + ARM_COMPUTE_EXPECT_EQUAL(classified_labels[i], expected_labels[i], framework::LogLevel::ERRORS); } - - BOOST_TEST(num_mismatches <= tolerance); } } // namespace validation } // namespace test diff --git a/tests/validation/Validation.h b/tests/validation/Validation.h index 57013312e1..db95e06058 100644 --- a/tests/validation/Validation.h +++ b/tests/validation/Validation.h @@ -21,44 +21,123 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_TEST_REFERENCE_VALIDATION_H__ -#define __ARM_COMPUTE_TEST_REFERENCE_VALIDATION_H__ +#ifndef __ARM_COMPUTE_TEST_VALIDATION_H__ +#define __ARM_COMPUTE_TEST_VALIDATION_H__ +#include "arm_compute/core/FixedPoint.h" #include "arm_compute/core/Types.h" -#include "arm_compute/runtime/Array.h" -#include "tests/RawTensor.h" - -#include "boost_wrapper.h" +#include "tests/IAccessor.h" +#include "tests/SimpleTensor.h" +#include "tests/TypePrinter.h" +#include "tests/Utils.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Exceptions.h" +#include <iomanip> +#include <ios> #include <vector> namespace arm_compute { -class Tensor; - namespace test { -class IAccessor; - namespace validation { +/** Class reprensenting an absolute tolerance value. */ +template <typename T> +class AbsoluteTolerance +{ +public: + /** Underlying type. */ + using value_type = T; + + /* Default constructor. + * + * Initialises the tolerance to 0. + */ + AbsoluteTolerance() = default; + + /** Constructor. + * + * @param[in] value Absolute tolerance value. + */ + explicit constexpr AbsoluteTolerance(T value) + : _value{ value } + { + } + + /** Implicit conversion to the underlying type. */ + constexpr operator T() const + { + return _value; + } + +private: + T _value{ std::numeric_limits<T>::epsilon() }; +}; + +/** Class reprensenting a relative tolerance value. */ +class RelativeTolerance +{ +public: + /** Underlying type. */ + using value_type = double; + + /* Default constructor. + * + * Initialises the tolerance to 0. + */ + RelativeTolerance() = default; + + /** Constructor. + * + * @param[in] value Relative tolerance value. + */ + explicit constexpr RelativeTolerance(value_type value) + : _value{ value } + { + } + + /** Implicit conversion to the underlying type. */ + constexpr operator value_type() const + { + return _value; + } + +private: + value_type _value{ 0 }; +}; + +/** Print AbsoluteTolerance type. */ +template <typename T> +inline ::std::ostream &operator<<(::std::ostream &os, const AbsoluteTolerance<T> &tolerance) +{ + os << static_cast<typename AbsoluteTolerance<T>::value_type>(tolerance); + + return os; +} + +/** Print RelativeTolerance type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const RelativeTolerance &tolerance) +{ + os << static_cast<typename RelativeTolerance::value_type>(tolerance); + + return os; +} + template <typename T> -boost::test_tools::predicate_result compare_dimensions(const Dimensions<T> &dimensions1, const Dimensions<T> &dimensions2) +bool compare_dimensions(const Dimensions<T> &dimensions1, const Dimensions<T> &dimensions2) { if(dimensions1.num_dimensions() != dimensions2.num_dimensions()) { - boost::test_tools::predicate_result result(false); - result.message() << "Different dimensionality [" << dimensions1.num_dimensions() << "!=" << dimensions2.num_dimensions() << "]"; - return result; + return false; } for(unsigned int i = 0; i < dimensions1.num_dimensions(); ++i) { if(dimensions1[i] != dimensions2[i]) { - boost::test_tools::predicate_result result(false); - result.message() << "Mismatch in dimension " << i << " [" << dimensions1[i] << "!=" << dimensions2[i] << "]"; - return result; + return false; } } @@ -89,7 +168,8 @@ void validate(const arm_compute::PaddingSize &padding, const arm_compute::Paddin * reference tensor and test tensor is multiple of wrap_range), but such errors would be detected by * other test cases. */ -void validate(const IAccessor &tensor, const RawTensor &reference, float tolerance_value = 0.f, float tolerance_number = 0.f, uint64_t wrap_range = 0); +template <typename T, typename U = AbsoluteTolerance<T>> +void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, U tolerance_value = U(), float tolerance_number = 0.f); /** Validate tensors with valid region. * @@ -101,19 +181,8 @@ void validate(const IAccessor &tensor, const RawTensor &reference, float toleran * reference tensor and test tensor is multiple of wrap_range), but such errors would be detected by * other test cases. */ -void validate(const IAccessor &tensor, const RawTensor &reference, const ValidRegion &valid_region, float tolerance_value = 0.f, float tolerance_number = 0.f, uint64_t wrap_range = 0); - -/** Validate tensors with valid mask. - * - * - Dimensionality has to be the same. - * - All values have to match. - * - * @note: wrap_range allows cases where reference tensor rounds up to the wrapping point, causing it to wrap around to - * zero while the test tensor stays at wrapping point to pass. This may permit true erroneous cases (difference between - * reference tensor and test tensor is multiple of wrap_range), but such errors would be detected by - * other test cases. - */ -void validate(const IAccessor &tensor, const RawTensor &reference, const RawTensor &valid_mask, float tolerance_value = 0.f, float tolerance_number = 0.f, uint64_t wrap_range = 0); +template <typename T, typename U = AbsoluteTolerance<T>> +void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const ValidRegion &valid_region, U tolerance_value = U(), float tolerance_number = 0.f); /** Validate tensors against constant value. * @@ -139,54 +208,143 @@ void validate(std::vector<unsigned int> classified_labels, std::vector<unsigned * * - All values should match */ -void validate(float target, float ref, float tolerance_abs_error = std::numeric_limits<float>::epsilon(), float tolerance_relative_error = 0.0001f); +template <typename T, typename U> +void validate(T target, T reference, U tolerance = AbsoluteTolerance<T>()); -/** Validate min max location. - * - * - All values should match - */ template <typename T> -void validate_min_max_loc(T min, T ref_min, T max, T ref_max, - IArray<Coordinates2D> &min_loc, IArray<Coordinates2D> &ref_min_loc, IArray<Coordinates2D> &max_loc, IArray<Coordinates2D> &ref_max_loc, - uint32_t min_count, uint32_t ref_min_count, uint32_t max_count, uint32_t ref_max_count) +struct compare_base { - BOOST_TEST(min == ref_min); - BOOST_TEST(max == ref_max); + compare_base(typename T::value_type target, typename T::value_type reference, T tolerance = T(0)) + : _target{ target }, _reference{ reference }, _tolerance{ tolerance } + { + } + + typename T::value_type _target{}; + typename T::value_type _reference{}; + T _tolerance{}; +}; - BOOST_TEST(min_count == min_loc.num_values()); - BOOST_TEST(max_count == max_loc.num_values()); - BOOST_TEST(ref_min_count == ref_min_loc.num_values()); - BOOST_TEST(ref_max_count == ref_max_loc.num_values()); +template <typename T, typename U> +struct compare; - BOOST_TEST(min_count == ref_min_count); - BOOST_TEST(max_count == ref_max_count); +template <typename U> +struct compare<AbsoluteTolerance<U>, U> : public compare_base<AbsoluteTolerance<U>> +{ + using compare_base<AbsoluteTolerance<U>>::compare_base; - for(uint32_t i = 0; i < min_count; i++) + operator bool() const { - Coordinates2D *same_coords = std::find_if(ref_min_loc.buffer(), ref_min_loc.buffer() + min_count, [&min_loc, i](Coordinates2D coord) + if(!std::isfinite(this->_target) || !std::isfinite(this->_reference)) { - return coord.x == min_loc.at(i).x && coord.y == min_loc.at(i).y; - }); + return false; + } + else if(this->_target == this->_reference) + { + return true; + } - BOOST_TEST(same_coords != ref_min_loc.buffer() + min_count); + return static_cast<U>(std::abs(this->_target - this->_reference)) <= static_cast<U>(this->_tolerance); } +}; + +template <typename U> +struct compare<RelativeTolerance, U> : public compare_base<RelativeTolerance> +{ + using compare_base<RelativeTolerance>::compare_base; - for(uint32_t i = 0; i < max_count; i++) + operator bool() const { - Coordinates2D *same_coords = std::find_if(ref_max_loc.buffer(), ref_max_loc.buffer() + max_count, [&max_loc, i](Coordinates2D coord) + if(!std::isfinite(_target) || !std::isfinite(_reference)) { - return coord.x == max_loc.at(i).x && coord.y == max_loc.at(i).y; - }); + return false; + } + else if(_target == _reference) + { + return true; + } - BOOST_TEST(same_coords != ref_max_loc.buffer() + max_count); + const double relative_change = std::abs(static_cast<double>(_target - _reference)) / _reference; + + return relative_change <= _tolerance; } +}; + +template <typename T, typename U> +void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, U tolerance_value, float tolerance_number) +{ + // Validate with valid region covering the entire shape + validate(tensor, reference, shape_to_valid_region(tensor.shape()), tolerance_value, tolerance_number); } -/** Validate KeyPoint arrays. - * - * - All values should match - */ -void validate(IArray<KeyPoint> &target, IArray<KeyPoint> &ref, int64_t tolerance = 0); +template <typename T, typename U> +void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const ValidRegion &valid_region, U tolerance_value, float tolerance_number) +{ + int64_t num_mismatches = 0; + int64_t num_elements = 0; + + ARM_COMPUTE_EXPECT_EQUAL(tensor.element_size(), reference.element_size(), framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT_EQUAL(tensor.data_type(), reference.data_type(), framework::LogLevel::ERRORS); + + if(reference.format() != Format::UNKNOWN) + { + ARM_COMPUTE_EXPECT_EQUAL(tensor.format(), reference.format(), framework::LogLevel::ERRORS); + } + + ARM_COMPUTE_EXPECT_EQUAL(tensor.num_channels(), reference.num_channels(), framework::LogLevel::ERRORS); + ARM_COMPUTE_EXPECT(compare_dimensions(tensor.shape(), reference.shape()), framework::LogLevel::ERRORS); + + const int min_elements = std::min(tensor.num_elements(), reference.num_elements()); + const int min_channels = std::min(tensor.num_channels(), reference.num_channels()); + + // Iterate over all elements within valid region, e.g. U8, S16, RGB888, ... + for(int element_idx = 0; element_idx < min_elements; ++element_idx) + { + const Coordinates id = index2coord(reference.shape(), element_idx); + + if(is_in_valid_region(valid_region, id)) + { + // Iterate over all channels within one element + for(int c = 0; c < min_channels; ++c) + { + const T &target_value = reinterpret_cast<const T *>(tensor(id))[c]; + const T &reference_value = reinterpret_cast<const T *>(reference(id))[c]; + + if(!compare<U, typename U::value_type>(target_value, reference_value, tolerance_value)) + { + ARM_COMPUTE_TEST_INFO("id = " << id); + ARM_COMPUTE_TEST_INFO("channel = " << c); + ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << framework::make_printable(target_value)); + ARM_COMPUTE_TEST_INFO("reference = " << std::setprecision(5) << framework::make_printable(reference_value)); + ARM_COMPUTE_TEST_INFO("tolerance = " << std::setprecision(5) << framework::make_printable(static_cast<typename U::value_type>(tolerance_value))); + ARM_COMPUTE_EXPECT_EQUAL(target_value, reference_value, framework::LogLevel::DEBUG); + + ++num_mismatches; + } + + ++num_elements; + } + } + } + + if(num_elements > 0) + { + const int64_t absolute_tolerance_number = tolerance_number * num_elements; + const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f; + + ARM_COMPUTE_TEST_INFO(num_mismatches << " values (" << std::fixed << std::setprecision(2) << percent_mismatches + << "%) mismatched (maximum tolerated " << std::setprecision(2) << tolerance_number << "%)"); + ARM_COMPUTE_EXPECT(num_mismatches <= absolute_tolerance_number, framework::LogLevel::ERRORS); + } +} + +template <typename T, typename U> +void validate(T target, T reference, U tolerance) +{ + ARM_COMPUTE_TEST_INFO("reference = " << std::setprecision(5) << framework::make_printable(reference)); + ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << framework::make_printable(target)); + ARM_COMPUTE_TEST_INFO("tolerance = " << std::setprecision(5) << framework::make_printable(static_cast<typename U::value_type>(tolerance))); + ARM_COMPUTE_EXPECT((compare<U, typename U::value_type>(target, reference, tolerance)), framework::LogLevel::ERRORS); +} } // namespace validation } // namespace test } // namespace arm_compute diff --git a/tests/validation_new/fixtures/ActivationLayerFixture.h b/tests/validation/fixtures/ActivationLayerFixture.h index bf0e7ba6ea..384e63bf49 100644 --- a/tests/validation_new/fixtures/ActivationLayerFixture.h +++ b/tests/validation/fixtures/ActivationLayerFixture.h @@ -26,13 +26,13 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/ActivationLayer.h" -#include "tests/validation_new/Helpers.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/ActivationLayer.h" +#include "tests/validation/Helpers.h" #include <random> diff --git a/tests/validation_new/fixtures/BitwiseAndFixture.h b/tests/validation/fixtures/BitwiseAndFixture.h index 1769ecdb1f..0dfff868ab 100644 --- a/tests/validation_new/fixtures/BitwiseAndFixture.h +++ b/tests/validation/fixtures/BitwiseAndFixture.h @@ -26,12 +26,12 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/BitwiseAnd.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/BitwiseAnd.h" namespace arm_compute { diff --git a/tests/validation_new/fixtures/BitwiseNotFixture.h b/tests/validation/fixtures/BitwiseNotFixture.h index 5954c8639e..e5bf69992e 100644 --- a/tests/validation_new/fixtures/BitwiseNotFixture.h +++ b/tests/validation/fixtures/BitwiseNotFixture.h @@ -26,12 +26,12 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/BitwiseNot.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/BitwiseNot.h" namespace arm_compute { diff --git a/tests/validation_new/fixtures/BitwiseOrFixture.h b/tests/validation/fixtures/BitwiseOrFixture.h index b39b46e813..d61e767bf3 100644 --- a/tests/validation_new/fixtures/BitwiseOrFixture.h +++ b/tests/validation/fixtures/BitwiseOrFixture.h @@ -26,12 +26,12 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/BitwiseOr.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/BitwiseOr.h" namespace arm_compute { diff --git a/tests/validation_new/fixtures/BitwiseXorFixture.h b/tests/validation/fixtures/BitwiseXorFixture.h index 1dfbf1f784..16fa8c0422 100644 --- a/tests/validation_new/fixtures/BitwiseXorFixture.h +++ b/tests/validation/fixtures/BitwiseXorFixture.h @@ -26,12 +26,12 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/BitwiseXor.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/BitwiseXor.h" namespace arm_compute { diff --git a/tests/validation_new/fixtures/ConvolutionLayerFixture.h b/tests/validation/fixtures/ConvolutionLayerFixture.h index 25a53d0c1d..87b11ac130 100644 --- a/tests/validation_new/fixtures/ConvolutionLayerFixture.h +++ b/tests/validation/fixtures/ConvolutionLayerFixture.h @@ -26,13 +26,13 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/ConvolutionLayer.h" -#include "tests/validation_new/Helpers.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/ConvolutionLayer.h" +#include "tests/validation/Helpers.h" #include <random> diff --git a/tests/validation_new/fixtures/DepthConcatenateLayerFixture.h b/tests/validation/fixtures/DepthConcatenateLayerFixture.h index 601758f80e..2a2e96e821 100644 --- a/tests/validation_new/fixtures/DepthConcatenateLayerFixture.h +++ b/tests/validation/fixtures/DepthConcatenateLayerFixture.h @@ -26,13 +26,13 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/DepthConcatenateLayer.h" -#include "tests/validation_new/Helpers.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/DepthConcatenateLayer.h" +#include "tests/validation/Helpers.h" #include <random> diff --git a/tests/validation_new/fixtures/DepthwiseConvolutionFixture.h b/tests/validation/fixtures/DepthwiseConvolutionFixture.h index b745c7e53c..462c0f888c 100644 --- a/tests/validation_new/fixtures/DepthwiseConvolutionFixture.h +++ b/tests/validation/fixtures/DepthwiseConvolutionFixture.h @@ -26,13 +26,13 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/DepthwiseConvolution.h" -#include "tests/validation_new/Helpers.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/DepthwiseConvolution.h" +#include "tests/validation/Helpers.h" #include <random> diff --git a/tests/validation_new/fixtures/DepthwiseSeparableConvolutionLayerFixture.h b/tests/validation/fixtures/DepthwiseSeparableConvolutionLayerFixture.h index c2578a9ce0..e8f6854b49 100644 --- a/tests/validation_new/fixtures/DepthwiseSeparableConvolutionLayerFixture.h +++ b/tests/validation/fixtures/DepthwiseSeparableConvolutionLayerFixture.h @@ -26,13 +26,13 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/DepthwiseSeparableConvolutionLayer.h" -#include "tests/validation_new/Helpers.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/DepthwiseSeparableConvolutionLayer.h" +#include "tests/validation/Helpers.h" #include <random> diff --git a/tests/validation_new/fixtures/DequantizationLayerFixture.h b/tests/validation/fixtures/DequantizationLayerFixture.h index 35c536d6a0..7543eb2d2e 100644 --- a/tests/validation_new/fixtures/DequantizationLayerFixture.h +++ b/tests/validation/fixtures/DequantizationLayerFixture.h @@ -27,12 +27,12 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" #include "arm_compute/runtime/Tensor.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/DequantizationLayer.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/DequantizationLayer.h" #include <random> diff --git a/tests/validation_new/fixtures/DirectConvolutionLayerFixture.h b/tests/validation/fixtures/DirectConvolutionLayerFixture.h index 0d138b47d9..6ffebce108 100644 --- a/tests/validation_new/fixtures/DirectConvolutionLayerFixture.h +++ b/tests/validation/fixtures/DirectConvolutionLayerFixture.h @@ -23,14 +23,14 @@ */ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/ConvolutionLayer.h" -#include "tests/validation_new/Helpers.h" -#include "tests/validation_new/fixtures/ConvolutionLayerFixture.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/ConvolutionLayer.h" +#include "tests/validation/Helpers.h" +#include "tests/validation/fixtures/ConvolutionLayerFixture.h" #include <random> diff --git a/tests/validation_new/fixtures/FloorFixture.h b/tests/validation/fixtures/FloorFixture.h index ab4c5c7e1e..3f948412af 100644 --- a/tests/validation_new/fixtures/FloorFixture.h +++ b/tests/validation/fixtures/FloorFixture.h @@ -27,12 +27,12 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" #include "arm_compute/runtime/Tensor.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/Floor.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/Floor.h" namespace arm_compute { diff --git a/tests/validation_new/fixtures/FullyConnectedLayerFixture.h b/tests/validation/fixtures/FullyConnectedLayerFixture.h index 0953b0b67e..d4d68f1af8 100644 --- a/tests/validation_new/fixtures/FullyConnectedLayerFixture.h +++ b/tests/validation/fixtures/FullyConnectedLayerFixture.h @@ -27,14 +27,14 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" #include "arm_compute/core/Utils.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" #include "tests/RawTensor.h" -#include "tests/validation_new/CPP/FullyConnectedLayer.h" -#include "tests/validation_new/Helpers.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/FullyConnectedLayer.h" +#include "tests/validation/Helpers.h" #include <random> diff --git a/tests/validation_new/fixtures/GEMMFixture.h b/tests/validation/fixtures/GEMMFixture.h index a6ab518d74..923a29c7d0 100644 --- a/tests/validation_new/fixtures/GEMMFixture.h +++ b/tests/validation/fixtures/GEMMFixture.h @@ -26,13 +26,13 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/GEMM.h" -#include "tests/validation_new/Helpers.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/GEMM.h" +#include "tests/validation/Helpers.h" #include <random> diff --git a/tests/validation_new/fixtures/L2NormalizeFixture.h b/tests/validation/fixtures/L2NormalizeFixture.h index 5102b93f51..e6113937f1 100644 --- a/tests/validation_new/fixtures/L2NormalizeFixture.h +++ b/tests/validation/fixtures/L2NormalizeFixture.h @@ -27,12 +27,12 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" #include "arm_compute/runtime/Tensor.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/L2Normalize.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/L2Normalize.h" namespace arm_compute { diff --git a/tests/validation_new/fixtures/MeanStdDevFixture.h b/tests/validation/fixtures/MeanStdDevFixture.h index 65622fca07..37f538b216 100644 --- a/tests/validation_new/fixtures/MeanStdDevFixture.h +++ b/tests/validation/fixtures/MeanStdDevFixture.h @@ -24,10 +24,10 @@ #ifndef ARM_COMPUTE_TEST_MEAN_STD_DEV_FIXTURE #define ARM_COMPUTE_TEST_MEAN_STD_DEV_FIXTURE -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/Globals.h" -#include "tests/validation_new/CPP/MeanStdDev.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/MeanStdDev.h" namespace arm_compute { diff --git a/tests/validation_new/fixtures/NormalizationLayerFixture.h b/tests/validation/fixtures/NormalizationLayerFixture.h index 044405473b..696d14fbbb 100644 --- a/tests/validation_new/fixtures/NormalizationLayerFixture.h +++ b/tests/validation/fixtures/NormalizationLayerFixture.h @@ -27,12 +27,12 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" #include "arm_compute/runtime/Tensor.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/NormalizationLayer.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/NormalizationLayer.h" #include <random> diff --git a/tests/validation_new/fixtures/PoolingLayerFixture.h b/tests/validation/fixtures/PoolingLayerFixture.h index c0c818f3a0..5ce4aa6755 100644 --- a/tests/validation_new/fixtures/PoolingLayerFixture.h +++ b/tests/validation/fixtures/PoolingLayerFixture.h @@ -27,12 +27,12 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" #include "arm_compute/runtime/Tensor.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/PoolingLayer.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/PoolingLayer.h" #include <random> diff --git a/tests/validation_new/fixtures/QuantizationLayerFixture.h b/tests/validation/fixtures/QuantizationLayerFixture.h index 469fd5f231..83ee0495f3 100644 --- a/tests/validation_new/fixtures/QuantizationLayerFixture.h +++ b/tests/validation/fixtures/QuantizationLayerFixture.h @@ -27,12 +27,12 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" #include "arm_compute/runtime/Tensor.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/QuantizationLayer.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/QuantizationLayer.h" #include <random> diff --git a/tests/validation_new/fixtures/ReductionOperationFixture.h b/tests/validation/fixtures/ReductionOperationFixture.h index 416aadf8d7..7c871aed3b 100644 --- a/tests/validation_new/fixtures/ReductionOperationFixture.h +++ b/tests/validation/fixtures/ReductionOperationFixture.h @@ -27,12 +27,12 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" #include "arm_compute/runtime/Tensor.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/ReductionOperation.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/ReductionOperation.h" namespace arm_compute { diff --git a/tests/validation_new/fixtures/ScaleFixture.h b/tests/validation/fixtures/ScaleFixture.h index 74dc0d6816..53bb0f2124 100644 --- a/tests/validation_new/fixtures/ScaleFixture.h +++ b/tests/validation/fixtures/ScaleFixture.h @@ -26,12 +26,12 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/Scale.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/Scale.h" namespace arm_compute { diff --git a/tests/validation_new/fixtures/SoftmaxLayerFixture.h b/tests/validation/fixtures/SoftmaxLayerFixture.h index c6f3d2216f..9c8f044e81 100644 --- a/tests/validation_new/fixtures/SoftmaxLayerFixture.h +++ b/tests/validation/fixtures/SoftmaxLayerFixture.h @@ -27,12 +27,12 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" #include "arm_compute/runtime/Tensor.h" -#include "framework/Asserts.h" -#include "framework/Fixture.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/IAccessor.h" -#include "tests/validation_new/CPP/SoftmaxLayer.h" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/validation/CPP/SoftmaxLayer.h" #include <random> diff --git a/tests/validation/half.h b/tests/validation/half.h index d8aa341068..0ca620cf57 100644 --- a/tests/validation/half.h +++ b/tests/validation/half.h @@ -34,4 +34,5 @@ #define HALF_ROUND_TIES_TO_EVEN 1 #include "half/half.hpp" + #endif /* __ARM_COMPUTE_TEST_HALF_H__ */ diff --git a/tests/validation_new/Helpers.h b/tests/validation_new/Helpers.h deleted file mode 100644 index 30959161bb..0000000000 --- a/tests/validation_new/Helpers.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef __ARM_COMPUTE_TEST_VALIDATION_HELPERS_H__ -#define __ARM_COMPUTE_TEST_VALIDATION_HELPERS_H__ - -#include "arm_compute/core/Types.h" -#include "arm_compute/core/Utils.h" -#include "tests/validation/half.h" - -#include <random> -#include <type_traits> -#include <utility> - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -template <typename T> -struct is_floating_point : public std::is_floating_point<T> -{ -}; - -template <> -struct is_floating_point<half_float::half> : public std::true_type -{ -}; - -/** Helper function to get the testing range for each activation layer. - * - * @param[in] activation Activation function to test. - * @param[in] data_type Data type. - * @param[in] fixed_point_position Number of bits for the fractional part. Defaults to 1. - * - * @return A pair containing the lower upper testing bounds for a given function. - */ -template <typename T> -std::pair<T, T> get_activation_layer_test_bounds(ActivationLayerInfo::ActivationFunction activation, DataType data_type, int fixed_point_position = 0) -{ - std::pair<T, T> bounds; - - switch(data_type) - { - case DataType::F16: - { - using namespace half_float::literal; - - switch(activation) - { - case ActivationLayerInfo::ActivationFunction::SQUARE: - case ActivationLayerInfo::ActivationFunction::LOGISTIC: - case ActivationLayerInfo::ActivationFunction::SOFT_RELU: - // Reduce range as exponent overflows - bounds = std::make_pair(-10._h, 10._h); - break; - case ActivationLayerInfo::ActivationFunction::SQRT: - // Reduce range as sqrt should take a non-negative number - bounds = std::make_pair(0._h, 255._h); - break; - default: - bounds = std::make_pair(-255._h, 255._h); - break; - } - break; - } - case DataType::F32: - switch(activation) - { - case ActivationLayerInfo::ActivationFunction::LOGISTIC: - case ActivationLayerInfo::ActivationFunction::SOFT_RELU: - // Reduce range as exponent overflows - bounds = std::make_pair(-40.f, 40.f); - break; - case ActivationLayerInfo::ActivationFunction::SQRT: - // Reduce range as sqrt should take a non-negative number - bounds = std::make_pair(0.f, 255.f); - break; - default: - bounds = std::make_pair(-255.f, 255.f); - break; - } - break; - case DataType::QS8: - case DataType::QS16: - switch(activation) - { - case ActivationLayerInfo::ActivationFunction::LOGISTIC: - case ActivationLayerInfo::ActivationFunction::SOFT_RELU: - case ActivationLayerInfo::ActivationFunction::TANH: - // Reduce range as exponent overflows - bounds = std::make_pair(-(1 << fixed_point_position), 1 << fixed_point_position); - break; - case ActivationLayerInfo::ActivationFunction::SQRT: - // Reduce range as sqrt should take a non-negative number - // Can't be zero either as inv_sqrt is used in NEON. - bounds = std::make_pair(1, std::numeric_limits<T>::max()); - break; - default: - bounds = std::make_pair(std::numeric_limits<T>::lowest(), std::numeric_limits<T>::max()); - break; - } - break; - default: - ARM_COMPUTE_ERROR("Unsupported data type"); - } - - return bounds; -} - -/** Calculate output tensor shape give a vector of input tensor to concatenate - * - * @param[in] input_shapes Shapes of the tensors to concatenate across depth. - * - * @return The shape of output concatenated tensor. - */ -TensorShape calculate_depth_concatenate_shape(const std::vector<TensorShape> &input_shapes); -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* __ARM_COMPUTE_TEST_VALIDATION_HELPERS_H__ */ diff --git a/tests/validation_new/Validation.cpp b/tests/validation_new/Validation.cpp deleted file mode 100644 index fec7c10939..0000000000 --- a/tests/validation_new/Validation.cpp +++ /dev/null @@ -1,307 +0,0 @@ -/* - * Copyright (c) 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "Validation.h" - -#include "arm_compute/core/Coordinates.h" -#include "arm_compute/core/Error.h" -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/runtime/Tensor.h" -#include "tests/validation/half.h" - -#include <array> -#include <cmath> -#include <cstddef> -#include <cstdint> - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace -{ -/** Get the data from *ptr after casting according to @p data_type and then convert the data to double. - * - * @param[in] ptr Pointer to value. - * @param[in] data_type Data type of both values. - * - * @return The data from the ptr after converted to double. - */ -double get_double_data(const void *ptr, DataType data_type) -{ - if(ptr == nullptr) - { - ARM_COMPUTE_ERROR("Can't dereference a null pointer!"); - } - - switch(data_type) - { - case DataType::U8: - return *reinterpret_cast<const uint8_t *>(ptr); - case DataType::S8: - return *reinterpret_cast<const int8_t *>(ptr); - case DataType::QS8: - return *reinterpret_cast<const qint8_t *>(ptr); - case DataType::U16: - return *reinterpret_cast<const uint16_t *>(ptr); - case DataType::S16: - return *reinterpret_cast<const int16_t *>(ptr); - case DataType::QS16: - return *reinterpret_cast<const qint16_t *>(ptr); - case DataType::U32: - return *reinterpret_cast<const uint32_t *>(ptr); - case DataType::S32: - return *reinterpret_cast<const int32_t *>(ptr); - case DataType::U64: - return *reinterpret_cast<const uint64_t *>(ptr); - case DataType::S64: - return *reinterpret_cast<const int64_t *>(ptr); - case DataType::F16: - return *reinterpret_cast<const half_float::half *>(ptr); - case DataType::F32: - return *reinterpret_cast<const float *>(ptr); - case DataType::F64: - return *reinterpret_cast<const double *>(ptr); - case DataType::SIZET: - return *reinterpret_cast<const size_t *>(ptr); - default: - ARM_COMPUTE_ERROR("NOT SUPPORTED!"); - } -} - -void check_border_element(const IAccessor &tensor, const Coordinates &id, - const BorderMode &border_mode, const void *border_value, - int64_t &num_elements, int64_t &num_mismatches) -{ - const size_t channel_size = element_size_from_data_type(tensor.data_type()); - const auto ptr = static_cast<const uint8_t *>(tensor(id)); - - if(border_mode == BorderMode::REPLICATE) - { - Coordinates border_id{ id }; - - if(id.x() < 0) - { - border_id.set(0, 0); - } - else if(static_cast<size_t>(id.x()) >= tensor.shape().x()) - { - border_id.set(0, tensor.shape().x() - 1); - } - - if(id.y() < 0) - { - border_id.set(1, 0); - } - else if(static_cast<size_t>(id.y()) >= tensor.shape().y()) - { - border_id.set(1, tensor.shape().y() - 1); - } - - border_value = tensor(border_id); - } - - // Iterate over all channels within one element - for(int channel = 0; channel < tensor.num_channels(); ++channel) - { - const size_t channel_offset = channel * channel_size; - const double target = get_double_data(ptr + channel_offset, tensor.data_type()); - const double reference = get_double_data(static_cast<const uint8_t *>(border_value) + channel_offset, tensor.data_type()); - - if(!compare<AbsoluteTolerance<double>, double>(target, reference)) - { - ARM_COMPUTE_TEST_INFO("id = " << id); - ARM_COMPUTE_TEST_INFO("channel = " << channel); - ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << target); - ARM_COMPUTE_TEST_INFO("reference = " << std::setprecision(5) << reference); - ARM_COMPUTE_EXPECT_EQUAL(target, reference, framework::LogLevel::DEBUG); - - ++num_mismatches; - } - - ++num_elements; - } -} -} // namespace - -void validate(const arm_compute::ValidRegion ®ion, const arm_compute::ValidRegion &reference) -{ - ARM_COMPUTE_EXPECT_EQUAL(region.anchor.num_dimensions(), reference.anchor.num_dimensions(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT_EQUAL(region.shape.num_dimensions(), reference.shape.num_dimensions(), framework::LogLevel::ERRORS); - - for(unsigned int d = 0; d < region.anchor.num_dimensions(); ++d) - { - ARM_COMPUTE_EXPECT_EQUAL(region.anchor[d], reference.anchor[d], framework::LogLevel::ERRORS); - } - - for(unsigned int d = 0; d < region.shape.num_dimensions(); ++d) - { - ARM_COMPUTE_EXPECT_EQUAL(region.shape[d], reference.shape[d], framework::LogLevel::ERRORS); - } -} - -void validate(const arm_compute::PaddingSize &padding, const arm_compute::PaddingSize &reference) -{ - ARM_COMPUTE_EXPECT_EQUAL(padding.top, reference.top, framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT_EQUAL(padding.right, reference.right, framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT_EQUAL(padding.bottom, reference.bottom, framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT_EQUAL(padding.left, reference.left, framework::LogLevel::ERRORS); -} - -void validate(const IAccessor &tensor, const void *reference_value) -{ - ARM_COMPUTE_ASSERT(reference_value != nullptr); - - int64_t num_mismatches = 0; - int64_t num_elements = 0; - const size_t channel_size = element_size_from_data_type(tensor.data_type()); - - // Iterate over all elements, e.g. U8, S16, RGB888, ... - for(int element_idx = 0; element_idx < tensor.num_elements(); ++element_idx) - { - const Coordinates id = index2coord(tensor.shape(), element_idx); - - const auto ptr = static_cast<const uint8_t *>(tensor(id)); - - // Iterate over all channels within one element - for(int channel = 0; channel < tensor.num_channels(); ++channel) - { - const size_t channel_offset = channel * channel_size; - const double target = get_double_data(ptr + channel_offset, tensor.data_type()); - const double reference = get_double_data(reference_value, tensor.data_type()); - - if(!compare<AbsoluteTolerance<double>, double>(target, reference)) - { - ARM_COMPUTE_TEST_INFO("id = " << id); - ARM_COMPUTE_TEST_INFO("channel = " << channel); - ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << target); - ARM_COMPUTE_TEST_INFO("reference = " << std::setprecision(5) << reference); - ARM_COMPUTE_EXPECT_EQUAL(target, reference, framework::LogLevel::DEBUG); - - ++num_mismatches; - } - - ++num_elements; - } - } - - if(num_elements > 0) - { - const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f; - - ARM_COMPUTE_TEST_INFO(num_mismatches << " values (" << std::fixed << std::setprecision(2) << percent_mismatches << "%) mismatched"); - ARM_COMPUTE_EXPECT_EQUAL(num_mismatches, 0, framework::LogLevel::ERRORS); - } -} - -void validate(const IAccessor &tensor, BorderSize border_size, const BorderMode &border_mode, const void *border_value) -{ - if(border_mode == BorderMode::UNDEFINED) - { - return; - } - else if(border_mode == BorderMode::CONSTANT) - { - ARM_COMPUTE_ASSERT(border_value != nullptr); - } - - int64_t num_mismatches = 0; - int64_t num_elements = 0; - const int slice_size = tensor.shape()[0] * tensor.shape()[1]; - - for(int element_idx = 0; element_idx < tensor.num_elements(); element_idx += slice_size) - { - Coordinates id = index2coord(tensor.shape(), element_idx); - - // Top border - for(int y = -border_size.top; y < 0; ++y) - { - id.set(1, y); - - for(int x = -border_size.left; x < static_cast<int>(tensor.shape()[0]) + static_cast<int>(border_size.right); ++x) - { - id.set(0, x); - - check_border_element(tensor, id, border_mode, border_value, num_elements, num_mismatches); - } - } - - // Bottom border - for(int y = tensor.shape()[1]; y < static_cast<int>(tensor.shape()[1]) + static_cast<int>(border_size.bottom); ++y) - { - id.set(1, y); - - for(int x = -border_size.left; x < static_cast<int>(tensor.shape()[0]) + static_cast<int>(border_size.right); ++x) - { - id.set(0, x); - - check_border_element(tensor, id, border_mode, border_value, num_elements, num_mismatches); - } - } - - // Left/right border - for(int y = 0; y < static_cast<int>(tensor.shape()[1]); ++y) - { - id.set(1, y); - - // Left border - for(int x = -border_size.left; x < 0; ++x) - { - id.set(0, x); - - check_border_element(tensor, id, border_mode, border_value, num_elements, num_mismatches); - } - - // Right border - for(int x = tensor.shape()[0]; x < static_cast<int>(tensor.shape()[0]) + static_cast<int>(border_size.right); ++x) - { - id.set(0, x); - - check_border_element(tensor, id, border_mode, border_value, num_elements, num_mismatches); - } - } - } - - if(num_elements > 0) - { - const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f; - - ARM_COMPUTE_TEST_INFO(num_mismatches << " values (" << std::fixed << std::setprecision(2) << percent_mismatches << "%) mismatched"); - ARM_COMPUTE_EXPECT_EQUAL(num_mismatches, 0, framework::LogLevel::ERRORS); - } -} - -void validate(std::vector<unsigned int> classified_labels, std::vector<unsigned int> expected_labels) -{ - ARM_COMPUTE_EXPECT_EQUAL(classified_labels.size(), expected_labels.size(), framework::LogLevel::ERRORS); - - for(unsigned int i = 0; i < expected_labels.size(); ++i) - { - ARM_COMPUTE_EXPECT_EQUAL(classified_labels[i], expected_labels[i], framework::LogLevel::ERRORS); - } -} -} // namespace validation -} // namespace test -} // namespace arm_compute diff --git a/tests/validation_new/Validation.h b/tests/validation_new/Validation.h deleted file mode 100644 index d3c3541982..0000000000 --- a/tests/validation_new/Validation.h +++ /dev/null @@ -1,351 +0,0 @@ -/* - * Copyright (c) 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef __ARM_COMPUTE_TEST_VALIDATION_H__ -#define __ARM_COMPUTE_TEST_VALIDATION_H__ - -#include "SimpleTensor.h" -#include "arm_compute/core/FixedPoint.h" -#include "arm_compute/core/Types.h" -#include "framework/Asserts.h" -#include "framework/Exceptions.h" -#include "tests/IAccessor.h" -#include "tests/TypePrinter.h" -#include "tests/Utils.h" - -#include <iomanip> -#include <ios> -#include <vector> - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -/** Class reprensenting an absolute tolerance value. */ -template <typename T> -class AbsoluteTolerance -{ -public: - /** Underlying type. */ - using value_type = T; - - /* Default constructor. - * - * Initialises the tolerance to 0. - */ - AbsoluteTolerance() = default; - - /** Constructor. - * - * @param[in] value Absolute tolerance value. - */ - explicit constexpr AbsoluteTolerance(T value) - : _value{ value } - { - } - - /** Implicit conversion to the underlying type. */ - constexpr operator T() const - { - return _value; - } - -private: - T _value{ std::numeric_limits<T>::epsilon() }; -}; - -/** Class reprensenting a relative tolerance value. */ -class RelativeTolerance -{ -public: - /** Underlying type. */ - using value_type = double; - - /* Default constructor. - * - * Initialises the tolerance to 0. - */ - RelativeTolerance() = default; - - /** Constructor. - * - * @param[in] value Relative tolerance value. - */ - explicit constexpr RelativeTolerance(value_type value) - : _value{ value } - { - } - - /** Implicit conversion to the underlying type. */ - constexpr operator value_type() const - { - return _value; - } - -private: - value_type _value{ 0 }; -}; - -/** Print AbsoluteTolerance type. */ -template <typename T> -inline ::std::ostream &operator<<(::std::ostream &os, const AbsoluteTolerance<T> &tolerance) -{ - os << static_cast<typename AbsoluteTolerance<T>::value_type>(tolerance); - - return os; -} - -/** Print RelativeTolerance type. */ -inline ::std::ostream &operator<<(::std::ostream &os, const RelativeTolerance &tolerance) -{ - os << static_cast<typename RelativeTolerance::value_type>(tolerance); - - return os; -} - -template <typename T> -bool compare_dimensions(const Dimensions<T> &dimensions1, const Dimensions<T> &dimensions2) -{ - if(dimensions1.num_dimensions() != dimensions2.num_dimensions()) - { - return false; - } - - for(unsigned int i = 0; i < dimensions1.num_dimensions(); ++i) - { - if(dimensions1[i] != dimensions2[i]) - { - return false; - } - } - - return true; -} - -/** Validate valid regions. - * - * - Dimensionality has to be the same. - * - Anchors have to match. - * - Shapes have to match. - */ -void validate(const arm_compute::ValidRegion ®ion, const arm_compute::ValidRegion &reference); - -/** Validate padding. - * - * Padding on all sides has to be the same. - */ -void validate(const arm_compute::PaddingSize &padding, const arm_compute::PaddingSize &reference); - -/** Validate tensors. - * - * - Dimensionality has to be the same. - * - All values have to match. - * - * @note: wrap_range allows cases where reference tensor rounds up to the wrapping point, causing it to wrap around to - * zero while the test tensor stays at wrapping point to pass. This may permit true erroneous cases (difference between - * reference tensor and test tensor is multiple of wrap_range), but such errors would be detected by - * other test cases. - */ -template <typename T, typename U = AbsoluteTolerance<T>> -void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, U tolerance_value = U(), float tolerance_number = 0.f); - -/** Validate tensors with valid region. - * - * - Dimensionality has to be the same. - * - All values have to match. - * - * @note: wrap_range allows cases where reference tensor rounds up to the wrapping point, causing it to wrap around to - * zero while the test tensor stays at wrapping point to pass. This may permit true erroneous cases (difference between - * reference tensor and test tensor is multiple of wrap_range), but such errors would be detected by - * other test cases. - */ -template <typename T, typename U = AbsoluteTolerance<T>> -void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const ValidRegion &valid_region, U tolerance_value = U(), float tolerance_number = 0.f); - -/** Validate tensors against constant value. - * - * - All values have to match. - */ -void validate(const IAccessor &tensor, const void *reference_value); - -/** Validate border against a constant value. - * - * - All border values have to match the specified value if mode is CONSTANT. - * - All border values have to be replicated if mode is REPLICATE. - * - Nothing is validated for mode UNDEFINED. - */ -void validate(const IAccessor &tensor, BorderSize border_size, const BorderMode &border_mode, const void *border_value); - -/** Validate classified labels against expected ones. - * - * - All values should match - */ -void validate(std::vector<unsigned int> classified_labels, std::vector<unsigned int> expected_labels); - -/** Validate float value. - * - * - All values should match - */ -template <typename T, typename U> -void validate(T target, T reference, U tolerance = AbsoluteTolerance<T>()); - -template <typename T> -struct compare_base -{ - compare_base(typename T::value_type target, typename T::value_type reference, T tolerance = T(0)) - : _target{ target }, _reference{ reference }, _tolerance{ tolerance } - { - } - - typename T::value_type _target{}; - typename T::value_type _reference{}; - T _tolerance{}; -}; - -template <typename T, typename U> -struct compare; - -template <typename U> -struct compare<AbsoluteTolerance<U>, U> : public compare_base<AbsoluteTolerance<U>> -{ - using compare_base<AbsoluteTolerance<U>>::compare_base; - - operator bool() const - { - if(!std::isfinite(this->_target) || !std::isfinite(this->_reference)) - { - return false; - } - else if(this->_target == this->_reference) - { - return true; - } - - return static_cast<U>(std::abs(this->_target - this->_reference)) <= static_cast<U>(this->_tolerance); - } -}; - -template <typename U> -struct compare<RelativeTolerance, U> : public compare_base<RelativeTolerance> -{ - using compare_base<RelativeTolerance>::compare_base; - - operator bool() const - { - if(!std::isfinite(_target) || !std::isfinite(_reference)) - { - return false; - } - else if(_target == _reference) - { - return true; - } - - const double relative_change = std::abs(static_cast<double>(_target - _reference)) / _reference; - - return relative_change <= _tolerance; - } -}; - -template <typename T, typename U> -void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, U tolerance_value, float tolerance_number) -{ - // Validate with valid region covering the entire shape - validate(tensor, reference, shape_to_valid_region(tensor.shape()), tolerance_value, tolerance_number); -} - -template <typename T, typename U> -void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const ValidRegion &valid_region, U tolerance_value, float tolerance_number) -{ - int64_t num_mismatches = 0; - int64_t num_elements = 0; - - ARM_COMPUTE_EXPECT_EQUAL(tensor.element_size(), reference.element_size(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT_EQUAL(tensor.data_type(), reference.data_type(), framework::LogLevel::ERRORS); - - if(reference.format() != Format::UNKNOWN) - { - ARM_COMPUTE_EXPECT_EQUAL(tensor.format(), reference.format(), framework::LogLevel::ERRORS); - } - - ARM_COMPUTE_EXPECT_EQUAL(tensor.num_channels(), reference.num_channels(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(compare_dimensions(tensor.shape(), reference.shape()), framework::LogLevel::ERRORS); - - const int min_elements = std::min(tensor.num_elements(), reference.num_elements()); - const int min_channels = std::min(tensor.num_channels(), reference.num_channels()); - - // Iterate over all elements within valid region, e.g. U8, S16, RGB888, ... - for(int element_idx = 0; element_idx < min_elements; ++element_idx) - { - const Coordinates id = index2coord(reference.shape(), element_idx); - - if(is_in_valid_region(valid_region, id)) - { - // Iterate over all channels within one element - for(int c = 0; c < min_channels; ++c) - { - const T &target_value = reinterpret_cast<const T *>(tensor(id))[c]; - const T &reference_value = reinterpret_cast<const T *>(reference(id))[c]; - - if(!compare<U, typename U::value_type>(target_value, reference_value, tolerance_value)) - { - ARM_COMPUTE_TEST_INFO("id = " << id); - ARM_COMPUTE_TEST_INFO("channel = " << c); - ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << framework::make_printable(target_value)); - ARM_COMPUTE_TEST_INFO("reference = " << std::setprecision(5) << framework::make_printable(reference_value)); - ARM_COMPUTE_TEST_INFO("tolerance = " << std::setprecision(5) << framework::make_printable(static_cast<typename U::value_type>(tolerance_value))); - ARM_COMPUTE_EXPECT_EQUAL(target_value, reference_value, framework::LogLevel::DEBUG); - - ++num_mismatches; - } - - ++num_elements; - } - } - } - - if(num_elements > 0) - { - const int64_t absolute_tolerance_number = tolerance_number * num_elements; - const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f; - - ARM_COMPUTE_TEST_INFO(num_mismatches << " values (" << std::fixed << std::setprecision(2) << percent_mismatches - << "%) mismatched (maximum tolerated " << std::setprecision(2) << tolerance_number << "%)"); - ARM_COMPUTE_EXPECT(num_mismatches <= absolute_tolerance_number, framework::LogLevel::ERRORS); - } -} - -template <typename T, typename U> -void validate(T target, T reference, U tolerance) -{ - ARM_COMPUTE_TEST_INFO("reference = " << std::setprecision(5) << framework::make_printable(reference)); - ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << framework::make_printable(target)); - ARM_COMPUTE_TEST_INFO("tolerance = " << std::setprecision(5) << framework::make_printable(static_cast<typename U::value_type>(tolerance))); - ARM_COMPUTE_EXPECT((compare<U, typename U::value_type>(target, reference, tolerance)), framework::LogLevel::ERRORS); -} -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* __ARM_COMPUTE_TEST_REFERENCE_VALIDATION_H__ */ diff --git a/tests/validation_old/AssetsLibrary.cpp b/tests/validation_old/AssetsLibrary.cpp new file mode 100644 index 0000000000..d7c881d9a8 --- /dev/null +++ b/tests/validation_old/AssetsLibrary.cpp @@ -0,0 +1,447 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "tests/AssetsLibrary.h" + +#include "TypePrinter.h" +#include "Utils.h" + +#include "arm_compute/core/ITensor.h" + +#include <cctype> +#include <fstream> +#include <limits> +#include <map> +#include <mutex> +#include <sstream> +#include <stdexcept> +#include <tuple> +#include <unordered_map> +#include <utility> + +namespace arm_compute +{ +namespace test +{ +namespace +{ +template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type = 0> +void rgb_to_luminance(const RawTensor &src, RawTensor &dst) +{ + const size_t min_size = std::min(src.size(), dst.size()); + + for(size_t i = 0, j = 0; i < min_size; i += 3, ++j) + { + reinterpret_cast<T *>(dst.data())[j] = 0.2126f * src.data()[i + 0] + 0.7152f * src.data()[i + 1] + 0.0722f * src.data()[i + 2]; + } +} + +void extract_r_from_rgb(const RawTensor &src, RawTensor &dst) +{ + const size_t min_size = std::min(src.size(), dst.size()); + + for(size_t i = 0, j = 0; i < min_size; i += 3, ++j) + { + dst.data()[j] = src.data()[i]; + } +} + +void extract_g_from_rgb(const RawTensor &src, RawTensor &dst) +{ + const size_t min_size = std::min(src.size(), dst.size()); + + for(size_t i = 1, j = 0; i < min_size; i += 3, ++j) + { + dst.data()[j] = src.data()[i]; + } +} + +void discard_comments(std::ifstream &fs) +{ + while(fs.peek() == '#') + { + fs.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); + } +} + +void discard_comments_and_spaces(std::ifstream &fs) +{ + while(true) + { + discard_comments(fs); + + if(isspace(fs.peek()) == 0) + { + break; + } + + fs.ignore(1); + } +} + +std::tuple<unsigned int, unsigned int, int> parse_ppm_header(std::ifstream &fs) +{ + // Check the PPM magic number is valid + std::array<char, 2> magic_number{ { 0 } }; + fs >> magic_number[0] >> magic_number[1]; + + if(magic_number[0] != 'P' || magic_number[1] != '6') + { + throw std::runtime_error("Only raw PPM format is suported"); + } + + discard_comments_and_spaces(fs); + + unsigned int width = 0; + fs >> width; + + discard_comments_and_spaces(fs); + + unsigned int height = 0; + fs >> height; + + discard_comments_and_spaces(fs); + + int max_value = 0; + fs >> max_value; + + if(!fs.good()) + { + throw std::runtime_error("Cannot read image dimensions"); + } + + if(max_value != 255) + { + throw std::runtime_error("RawTensor doesn't have 8-bit values"); + } + + discard_comments(fs); + + if(isspace(fs.peek()) == 0) + { + throw std::runtime_error("Invalid PPM header"); + } + + fs.ignore(1); + + return std::make_tuple(width, height, max_value); +} + +RawTensor load_ppm(const std::string &path) +{ + std::ifstream file(path, std::ios::in | std::ios::binary); + + if(!file.good()) + { + throw std::runtime_error("Could not load PPM image: " + path); + } + + unsigned int width = 0; + unsigned int height = 0; + + std::tie(width, height, std::ignore) = parse_ppm_header(file); + + RawTensor raw(TensorShape(width, height), Format::RGB888); + + // Check if the file is large enough to fill the image + const size_t current_position = file.tellg(); + file.seekg(0, std::ios_base::end); + const size_t end_position = file.tellg(); + file.seekg(current_position, std::ios_base::beg); + + if((end_position - current_position) < raw.size()) + { + throw std::runtime_error("Not enough data in file"); + } + + file.read(reinterpret_cast<std::fstream::char_type *>(raw.data()), raw.size()); + + if(!file.good()) + { + throw std::runtime_error("Failure while reading image buffer"); + } + + return raw; +} +} // namespace + +AssetsLibrary::AssetsLibrary(std::string path, std::random_device::result_type seed) //NOLINT + : _library_path(std::move(path)), + _seed{ seed } +{ +} + +std::random_device::result_type AssetsLibrary::seed() const +{ + return _seed; +} + +void AssetsLibrary::fill(RawTensor &raw, const std::string &name, Format format) const +{ + //FIXME: Should be done by swapping cached buffers + const RawTensor &src = get(name, format); + std::copy_n(src.data(), raw.size(), raw.data()); +} + +void AssetsLibrary::fill(RawTensor &raw, const std::string &name, Channel channel) const +{ + fill(raw, name, get_format_for_channel(channel), channel); +} + +void AssetsLibrary::fill(RawTensor &raw, const std::string &name, Format format, Channel channel) const +{ + const RawTensor &src = get(name, format, channel); + std::copy_n(src.data(), raw.size(), raw.data()); +} + +const AssetsLibrary::Loader &AssetsLibrary::get_loader(const std::string &extension) const +{ + static std::unordered_map<std::string, Loader> loaders = + { + { "ppm", load_ppm } + }; + + const auto it = loaders.find(extension); + + if(it != loaders.end()) + { + return it->second; + } + else + { + throw std::invalid_argument("Cannot load image with extension '" + extension + "'"); + } +} + +const AssetsLibrary::Converter &AssetsLibrary::get_converter(Format src, Format dst) const +{ + static std::map<std::pair<Format, Format>, Converter> converters = + { + { std::make_pair(Format::RGB888, Format::U8), rgb_to_luminance<uint8_t> }, + { std::make_pair(Format::RGB888, Format::U16), rgb_to_luminance<uint16_t> }, + { std::make_pair(Format::RGB888, Format::S16), rgb_to_luminance<int16_t> }, + { std::make_pair(Format::RGB888, Format::U32), rgb_to_luminance<uint32_t> } + }; + + const auto it = converters.find(std::make_pair(src, dst)); + + if(it != converters.end()) + { + return it->second; + } + else + { + std::stringstream msg; + msg << "Cannot convert from format '" << src << "' to format '" << dst << "'\n"; + throw std::invalid_argument(msg.str()); + } +} + +const AssetsLibrary::Converter &AssetsLibrary::get_converter(DataType src, Format dst) const +{ + static std::map<std::pair<DataType, Format>, Converter> converters = {}; + + const auto it = converters.find(std::make_pair(src, dst)); + + if(it != converters.end()) + { + return it->second; + } + else + { + std::stringstream msg; + msg << "Cannot convert from data type '" << src << "' to format '" << dst << "'\n"; + throw std::invalid_argument(msg.str()); + } +} + +const AssetsLibrary::Converter &AssetsLibrary::get_converter(DataType src, DataType dst) const +{ + static std::map<std::pair<DataType, DataType>, Converter> converters = {}; + + const auto it = converters.find(std::make_pair(src, dst)); + + if(it != converters.end()) + { + return it->second; + } + else + { + std::stringstream msg; + msg << "Cannot convert from data type '" << src << "' to data type '" << dst << "'\n"; + throw std::invalid_argument(msg.str()); + } +} + +const AssetsLibrary::Converter &AssetsLibrary::get_converter(Format src, DataType dst) const +{ + static std::map<std::pair<Format, DataType>, Converter> converters = {}; + + const auto it = converters.find(std::make_pair(src, dst)); + + if(it != converters.end()) + { + return it->second; + } + else + { + std::stringstream msg; + msg << "Cannot convert from format '" << src << "' to data type '" << dst << "'\n"; + throw std::invalid_argument(msg.str()); + } +} + +const AssetsLibrary::Extractor &AssetsLibrary::get_extractor(Format format, Channel channel) const +{ + static std::map<std::pair<Format, Channel>, Extractor> extractors = + { + { std::make_pair(Format::RGB888, Channel::R), extract_r_from_rgb }, + { std::make_pair(Format::RGB888, Channel::G), extract_g_from_rgb } + }; + + const auto it = extractors.find(std::make_pair(format, channel)); + + if(it != extractors.end()) + { + return it->second; + } + else + { + std::stringstream msg; + msg << "Cannot extract channel '" << channel << "' from format '" << format << "'\n"; + throw std::invalid_argument(msg.str()); + } +} + +RawTensor AssetsLibrary::load_image(const std::string &name) const +{ +#ifdef _WIN32 + const std::string image_path = ("\\images\\"); +#else /* _WIN32 */ + const std::string image_path = ("/images/"); +#endif /* _WIN32 */ + + const std::string path = _library_path + image_path + name; + const std::string extension = path.substr(path.find_last_of('.') + 1); + return (*get_loader(extension))(path); +} + +const RawTensor &AssetsLibrary::find_or_create_raw_tensor(const std::string &name, Format format) const +{ + std::lock_guard<std::mutex> guard(_format_lock); + + const RawTensor *ptr = _cache.find(std::make_tuple(name, format)); + + if(ptr != nullptr) + { + return *ptr; + } + + RawTensor raw = load_image(name); + + if(raw.format() != format) + { + //FIXME: Remove unnecessary copy + RawTensor dst(raw.shape(), format); + (*get_converter(raw.format(), format))(raw, dst); + raw = std::move(dst); + } + + return _cache.add(std::make_tuple(name, format), std::move(raw)); +} + +const RawTensor &AssetsLibrary::find_or_create_raw_tensor(const std::string &name, Format format, Channel channel) const +{ + std::lock_guard<std::mutex> guard(_channel_lock); + + const RawTensor *ptr = _cache.find(std::make_tuple(name, format, channel)); + + if(ptr != nullptr) + { + return *ptr; + } + + const RawTensor &src = get(name, format); + //FIXME: Need to change shape to match channel + RawTensor dst(src.shape(), get_channel_format(channel)); + + (*get_extractor(format, channel))(src, dst); + + return _cache.add(std::make_tuple(name, format, channel), std::move(dst)); +} + +TensorShape AssetsLibrary::get_image_shape(const std::string &name) +{ + return load_image(name).shape(); +} + +const RawTensor &AssetsLibrary::get(const std::string &name) const +{ + //FIXME: Format should be derived from the image name. Not be fixed to RGB. + return find_or_create_raw_tensor(name, Format::RGB888); +} + +RawTensor AssetsLibrary::get(const std::string &name) +{ + //FIXME: Format should be derived from the image name. Not be fixed to RGB. + return RawTensor(find_or_create_raw_tensor(name, Format::RGB888)); +} + +RawTensor AssetsLibrary::get(const std::string &name, DataType data_type, int num_channels) const +{ + const RawTensor &raw = get(name); + + return RawTensor(raw.shape(), data_type, num_channels); +} + +const RawTensor &AssetsLibrary::get(const std::string &name, Format format) const +{ + return find_or_create_raw_tensor(name, format); +} + +RawTensor AssetsLibrary::get(const std::string &name, Format format) +{ + return RawTensor(find_or_create_raw_tensor(name, format)); +} + +const RawTensor &AssetsLibrary::get(const std::string &name, Channel channel) const +{ + return get(name, get_format_for_channel(channel), channel); +} + +RawTensor AssetsLibrary::get(const std::string &name, Channel channel) +{ + return RawTensor(get(name, get_format_for_channel(channel), channel)); +} + +const RawTensor &AssetsLibrary::get(const std::string &name, Format format, Channel channel) const +{ + return find_or_create_raw_tensor(name, format, channel); +} + +RawTensor AssetsLibrary::get(const std::string &name, Format format, Channel channel) +{ + return RawTensor(find_or_create_raw_tensor(name, format, channel)); +} +} // namespace test +} // namespace arm_compute diff --git a/tests/validation_old/AssetsLibrary.h b/tests/validation_old/AssetsLibrary.h new file mode 100644 index 0000000000..6945aa6fe1 --- /dev/null +++ b/tests/validation_old/AssetsLibrary.h @@ -0,0 +1,674 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef __ARM_COMPUTE_TEST_TENSOR_LIBRARY_H__ +#define __ARM_COMPUTE_TEST_TENSOR_LIBRARY_H__ + +#include "arm_compute/core/Coordinates.h" +#include "arm_compute/core/Error.h" +#include "arm_compute/core/Helpers.h" +#include "arm_compute/core/TensorInfo.h" +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" +#include "arm_compute/core/Window.h" +#include "tests/RawTensor.h" +#include "tests/TensorCache.h" +#include "tests/Utils.h" +#include "tests/validation_old/half.h" + +#include <algorithm> +#include <cstddef> +#include <fstream> +#include <random> +#include <string> +#include <type_traits> + +namespace arm_compute +{ +namespace test +{ +/** Factory class to create and fill tensors. + * + * Allows to initialise tensors from loaded images or by specifying the shape + * explicitly. Furthermore, provides methods to fill tensors with the content of + * loaded images or with random values. + */ +class AssetsLibrary final +{ +public: + /** Initialises the library with a @p path to the image directory. + * Furthermore, sets the seed for the random generator to @p seed. + * + * @param[in] path Path to load images from. + * @param[in] seed Seed used to initialise the random number generator. + */ + AssetsLibrary(std::string path, std::random_device::result_type seed); + + /** Seed that is used to fill tensors with random values. */ + std::random_device::result_type seed() const; + + /** Provides a tensor shape for the specified image. + * + * @param[in] name Image file used to look up the raw tensor. + */ + TensorShape get_image_shape(const std::string &name); + + /** Provides a contant raw tensor for the specified image. + * + * @param[in] name Image file used to look up the raw tensor. + */ + const RawTensor &get(const std::string &name) const; + + /** Provides a raw tensor for the specified image. + * + * @param[in] name Image file used to look up the raw tensor. + */ + RawTensor get(const std::string &name); + + /** Creates an uninitialised raw tensor with the given @p data_type and @p + * num_channels. The shape is derived from the specified image. + * + * @param[in] name Image file used to initialise the tensor. + * @param[in] data_type Data type used to initialise the tensor. + * @param[in] num_channels Number of channels used to initialise the tensor. + */ + RawTensor get(const std::string &name, DataType data_type, int num_channels = 1) const; + + /** Provides a contant raw tensor for the specified image after it has been + * converted to @p format. + * + * @param[in] name Image file used to look up the raw tensor. + * @param[in] format Format used to look up the raw tensor. + */ + const RawTensor &get(const std::string &name, Format format) const; + + /** Provides a raw tensor for the specified image after it has been + * converted to @p format. + * + * @param[in] name Image file used to look up the raw tensor. + * @param[in] format Format used to look up the raw tensor. + */ + RawTensor get(const std::string &name, Format format); + + /** Provides a contant raw tensor for the specified channel after it has + * been extracted form the given image. + * + * @param[in] name Image file used to look up the raw tensor. + * @param[in] channel Channel used to look up the raw tensor. + * + * @note The channel has to be unambiguous so that the format can be + * inferred automatically. + */ + const RawTensor &get(const std::string &name, Channel channel) const; + + /** Provides a raw tensor for the specified channel after it has been + * extracted form the given image. + * + * @param[in] name Image file used to look up the raw tensor. + * @param[in] channel Channel used to look up the raw tensor. + * + * @note The channel has to be unambiguous so that the format can be + * inferred automatically. + */ + RawTensor get(const std::string &name, Channel channel); + + /** Provides a constant raw tensor for the specified channel after it has + * been extracted form the given image formatted to @p format. + * + * @param[in] name Image file used to look up the raw tensor. + * @param[in] format Format used to look up the raw tensor. + * @param[in] channel Channel used to look up the raw tensor. + */ + const RawTensor &get(const std::string &name, Format format, Channel channel) const; + + /** Provides a raw tensor for the specified channel after it has been + * extracted form the given image formatted to @p format. + * + * @param[in] name Image file used to look up the raw tensor. + * @param[in] format Format used to look up the raw tensor. + * @param[in] channel Channel used to look up the raw tensor. + */ + RawTensor get(const std::string &name, Format format, Channel channel); + + /** Puts garbage values all around the tensor for testing purposes + * + * @param[in, out] tensor To be filled tensor. + * @param[in] distribution Distribution used to fill the tensor's surroundings. + * @param[in] seed_offset The offset will be added to the global seed before initialising the random generator. + */ + template <typename T, typename D> + void fill_borders_with_garbage(T &&tensor, D &&distribution, std::random_device::result_type seed_offset) const; + + /** Fills the specified @p tensor with random values drawn from @p + * distribution. + * + * @param[in, out] tensor To be filled tensor. + * @param[in] distribution Distribution used to fill the tensor. + * @param[in] seed_offset The offset will be added to the global seed before initialising the random generator. + * + * @note The @p distribution has to provide operator(Generator &) which + * will be used to draw samples. + */ + template <typename T, typename D> + void fill(T &&tensor, D &&distribution, std::random_device::result_type seed_offset) const; + + /** Fills the specified @p raw tensor with random values drawn from @p + * distribution. + * + * @param[in, out] raw To be filled raw. + * @param[in] distribution Distribution used to fill the tensor. + * @param[in] seed_offset The offset will be added to the global seed before initialising the random generator. + * + * @note The @p distribution has to provide operator(Generator &) which + * will be used to draw samples. + */ + template <typename D> + void fill(RawTensor &raw, D &&distribution, std::random_device::result_type seed_offset) const; + + /** Fills the specified @p tensor with the content of the specified image + * converted to the given format. + * + * @param[in, out] tensor To be filled tensor. + * @param[in] name Image file used to fill the tensor. + * @param[in] format Format of the image used to fill the tensor. + * + * @warning No check is performed that the specified format actually + * matches the format of the tensor. + */ + template <typename T> + void fill(T &&tensor, const std::string &name, Format format) const; + + /** Fills the raw tensor with the content of the specified image + * converted to the given format. + * + * @param[in, out] raw To be filled raw tensor. + * @param[in] name Image file used to fill the tensor. + * @param[in] format Format of the image used to fill the tensor. + * + * @warning No check is performed that the specified format actually + * matches the format of the tensor. + */ + void fill(RawTensor &raw, const std::string &name, Format format) const; + + /** Fills the specified @p tensor with the content of the specified channel + * extracted from the given image. + * + * @param[in, out] tensor To be filled tensor. + * @param[in] name Image file used to fill the tensor. + * @param[in] channel Channel of the image used to fill the tensor. + * + * @note The channel has to be unambiguous so that the format can be + * inferred automatically. + * + * @warning No check is performed that the specified format actually + * matches the format of the tensor. + */ + template <typename T> + void fill(T &&tensor, const std::string &name, Channel channel) const; + + /** Fills the raw tensor with the content of the specified channel + * extracted from the given image. + * + * @param[in, out] raw To be filled raw tensor. + * @param[in] name Image file used to fill the tensor. + * @param[in] channel Channel of the image used to fill the tensor. + * + * @note The channel has to be unambiguous so that the format can be + * inferred automatically. + * + * @warning No check is performed that the specified format actually + * matches the format of the tensor. + */ + void fill(RawTensor &raw, const std::string &name, Channel channel) const; + + /** Fills the specified @p tensor with the content of the specified channel + * extracted from the given image after it has been converted to the given + * format. + * + * @param[in, out] tensor To be filled tensor. + * @param[in] name Image file used to fill the tensor. + * @param[in] format Format of the image used to fill the tensor. + * @param[in] channel Channel of the image used to fill the tensor. + * + * @warning No check is performed that the specified format actually + * matches the format of the tensor. + */ + template <typename T> + void fill(T &&tensor, const std::string &name, Format format, Channel channel) const; + + /** Fills the raw tensor with the content of the specified channel + * extracted from the given image after it has been converted to the given + * format. + * + * @param[in, out] raw To be filled raw tensor. + * @param[in] name Image file used to fill the tensor. + * @param[in] format Format of the image used to fill the tensor. + * @param[in] channel Channel of the image used to fill the tensor. + * + * @warning No check is performed that the specified format actually + * matches the format of the tensor. + */ + void fill(RawTensor &raw, const std::string &name, Format format, Channel channel) const; + + /** Fill a tensor with uniform distribution across the range of its type + * + * @param[in, out] tensor To be filled tensor. + * @param[in] seed_offset The offset will be added to the global seed before initialising the random generator. + */ + template <typename T> + void fill_tensor_uniform(T &&tensor, std::random_device::result_type seed_offset) const; + + /** Fill a tensor with uniform distribution across the a specified range + * + * @param[in, out] tensor To be filled tensor. + * @param[in] seed_offset The offset will be added to the global seed before initialising the random generator. + * @param[in] low lowest value in the range (inclusive) + * @param[in] high highest value in the range (inclusive) + * + * @note @p low and @p high must be of the same type as the data type of @p tensor + */ + template <typename T, typename D> + void fill_tensor_uniform(T &&tensor, std::random_device::result_type seed_offset, D low, D high) const; + + /** Fills the specified @p tensor with data loaded from binary in specified path. + * + * @param[in, out] tensor To be filled tensor. + * @param[in] name Data file. + */ + template <typename T> + void fill_layer_data(T &&tensor, std::string name) const; + +private: + // Function prototype to convert between image formats. + using Converter = void (*)(const RawTensor &src, RawTensor &dst); + // Function prototype to extract a channel from an image. + using Extractor = void (*)(const RawTensor &src, RawTensor &dst); + // Function prototype to load an image file. + using Loader = RawTensor (*)(const std::string &path); + + const Converter &get_converter(Format src, Format dst) const; + const Converter &get_converter(DataType src, Format dst) const; + const Converter &get_converter(Format src, DataType dst) const; + const Converter &get_converter(DataType src, DataType dst) const; + const Extractor &get_extractor(Format format, Channel) const; + const Loader &get_loader(const std::string &extension) const; + + /** Creates a raw tensor from the specified image. + * + * @param[in] name To be loaded image file. + * + * @note If use_single_image is true @p name is ignored and the user image + * is loaded instead. + */ + RawTensor load_image(const std::string &name) const; + + /** Provides a raw tensor for the specified image and format. + * + * @param[in] name Image file used to look up the raw tensor. + * @param[in] format Format used to look up the raw tensor. + * + * If the tensor has already been requested before the cached version will + * be returned. Otherwise the tensor will be added to the cache. + * + * @note If use_single_image is true @p name is ignored and the user image + * is loaded instead. + */ + const RawTensor &find_or_create_raw_tensor(const std::string &name, Format format) const; + + /** Provides a raw tensor for the specified image, format and channel. + * + * @param[in] name Image file used to look up the raw tensor. + * @param[in] format Format used to look up the raw tensor. + * @param[in] channel Channel used to look up the raw tensor. + * + * If the tensor has already been requested before the cached version will + * be returned. Otherwise the tensor will be added to the cache. + * + * @note If use_single_image is true @p name is ignored and the user image + * is loaded instead. + */ + const RawTensor &find_or_create_raw_tensor(const std::string &name, Format format, Channel channel) const; + + mutable TensorCache _cache{}; + mutable std::mutex _format_lock{}; + mutable std::mutex _channel_lock{}; + const std::string _library_path; + std::random_device::result_type _seed; +}; + +template <typename T, typename D> +void AssetsLibrary::fill_borders_with_garbage(T &&tensor, D &&distribution, std::random_device::result_type seed_offset) const +{ + const PaddingSize padding_size = tensor.padding(); + + Window window; + window.set(0, Window::Dimension(-padding_size.left, tensor.shape()[0] + padding_size.right, 1)); + window.set(1, Window::Dimension(-padding_size.top, tensor.shape()[1] + padding_size.bottom, 1)); + + std::mt19937 gen(_seed); + + execute_window_loop(window, [&](const Coordinates & id) + { + TensorShape shape = tensor.shape(); + + // If outside of valid region + if(id.x() < 0 || id.x() >= static_cast<int>(shape.x()) || id.y() < 0 || id.y() >= static_cast<int>(shape.y())) + { + using ResultType = typename std::remove_reference<D>::type::result_type; + const ResultType value = distribution(gen); + void *const out_ptr = tensor(id); + store_value_with_data_type(out_ptr, value, tensor.data_type()); + } + }); +} + +template <typename T, typename D> +void AssetsLibrary::fill(T &&tensor, D &&distribution, std::random_device::result_type seed_offset) const +{ + Window window; + for(unsigned int d = 0; d < tensor.shape().num_dimensions(); ++d) + { + window.set(d, Window::Dimension(0, tensor.shape()[d], 1)); + } + + std::mt19937 gen(_seed + seed_offset); + + //FIXME: Replace with normal loop + execute_window_loop(window, [&](const Coordinates & id) + { + using ResultType = typename std::remove_reference<D>::type::result_type; + const ResultType value = distribution(gen); + void *const out_ptr = tensor(id); + store_value_with_data_type(out_ptr, value, tensor.data_type()); + }); + + fill_borders_with_garbage(tensor, distribution, seed_offset); +} + +template <typename D> +void AssetsLibrary::fill(RawTensor &raw, D &&distribution, std::random_device::result_type seed_offset) const +{ + std::mt19937 gen(_seed + seed_offset); + + for(size_t offset = 0; offset < raw.size(); offset += raw.element_size()) + { + using ResultType = typename std::remove_reference<D>::type::result_type; + const ResultType value = distribution(gen); + store_value_with_data_type(raw.data() + offset, value, raw.data_type()); + } +} + +template <typename T> +void AssetsLibrary::fill(T &&tensor, const std::string &name, Format format) const +{ + const RawTensor &raw = get(name, format); + + for(size_t offset = 0; offset < raw.size(); offset += raw.element_size()) + { + const Coordinates id = index2coord(raw.shape(), offset / raw.element_size()); + + const RawTensor::value_type *const raw_ptr = raw.data() + offset; + const auto out_ptr = static_cast<RawTensor::value_type *>(tensor(id)); + std::copy_n(raw_ptr, raw.element_size(), out_ptr); + } +} + +template <typename T> +void AssetsLibrary::fill(T &&tensor, const std::string &name, Channel channel) const +{ + fill(std::forward<T>(tensor), name, get_format_for_channel(channel), channel); +} + +template <typename T> +void AssetsLibrary::fill(T &&tensor, const std::string &name, Format format, Channel channel) const +{ + const RawTensor &raw = get(name, format, channel); + + for(size_t offset = 0; offset < raw.size(); offset += raw.element_size()) + { + const Coordinates id = index2coord(raw.shape(), offset / raw.element_size()); + + const RawTensor::value_type *const raw_ptr = raw.data() + offset; + const auto out_ptr = static_cast<RawTensor::value_type *>(tensor(id)); + std::copy_n(raw_ptr, raw.element_size(), out_ptr); + } +} + +template <typename T> +void AssetsLibrary::fill_tensor_uniform(T &&tensor, std::random_device::result_type seed_offset) const +{ + switch(tensor.data_type()) + { + case DataType::U8: + { + std::uniform_int_distribution<uint8_t> distribution_u8(std::numeric_limits<uint8_t>::lowest(), std::numeric_limits<uint8_t>::max()); + fill(tensor, distribution_u8, seed_offset); + break; + } + case DataType::S8: + case DataType::QS8: + { + std::uniform_int_distribution<int8_t> distribution_s8(std::numeric_limits<int8_t>::lowest(), std::numeric_limits<int8_t>::max()); + fill(tensor, distribution_s8, seed_offset); + break; + } + case DataType::U16: + { + std::uniform_int_distribution<uint16_t> distribution_u16(std::numeric_limits<uint16_t>::lowest(), std::numeric_limits<uint16_t>::max()); + fill(tensor, distribution_u16, seed_offset); + break; + } + case DataType::S16: + case DataType::QS16: + { + std::uniform_int_distribution<int16_t> distribution_s16(std::numeric_limits<int16_t>::lowest(), std::numeric_limits<int16_t>::max()); + fill(tensor, distribution_s16, seed_offset); + break; + } + case DataType::U32: + { + std::uniform_int_distribution<uint32_t> distribution_u32(std::numeric_limits<uint32_t>::lowest(), std::numeric_limits<uint32_t>::max()); + fill(tensor, distribution_u32, seed_offset); + break; + } + case DataType::S32: + { + std::uniform_int_distribution<int32_t> distribution_s32(std::numeric_limits<int32_t>::lowest(), std::numeric_limits<int32_t>::max()); + fill(tensor, distribution_s32, seed_offset); + break; + } + case DataType::U64: + { + std::uniform_int_distribution<uint64_t> distribution_u64(std::numeric_limits<uint64_t>::lowest(), std::numeric_limits<uint64_t>::max()); + fill(tensor, distribution_u64, seed_offset); + break; + } + case DataType::S64: + { + std::uniform_int_distribution<int64_t> distribution_s64(std::numeric_limits<int64_t>::lowest(), std::numeric_limits<int64_t>::max()); + fill(tensor, distribution_s64, seed_offset); + break; + } + case DataType::F16: + { + // It doesn't make sense to check [-inf, inf], so hard code it to a big number + std::uniform_real_distribution<float> distribution_f16(-100.f, 100.f); + fill(tensor, distribution_f16, seed_offset); + break; + } + case DataType::F32: + { + // It doesn't make sense to check [-inf, inf], so hard code it to a big number + std::uniform_real_distribution<float> distribution_f32(-1000.f, 1000.f); + fill(tensor, distribution_f32, seed_offset); + break; + } + case DataType::F64: + { + // It doesn't make sense to check [-inf, inf], so hard code it to a big number + std::uniform_real_distribution<double> distribution_f64(-1000.f, 1000.f); + fill(tensor, distribution_f64, seed_offset); + break; + } + case DataType::SIZET: + { + std::uniform_int_distribution<size_t> distribution_sizet(std::numeric_limits<size_t>::lowest(), std::numeric_limits<size_t>::max()); + fill(tensor, distribution_sizet, seed_offset); + break; + } + default: + ARM_COMPUTE_ERROR("NOT SUPPORTED!"); + } +} + +template <typename T, typename D> +void AssetsLibrary::fill_tensor_uniform(T &&tensor, std::random_device::result_type seed_offset, D low, D high) const +{ + switch(tensor.data_type()) + { + case DataType::U8: + { + ARM_COMPUTE_ERROR_ON(!(std::is_same<uint8_t, D>::value)); + std::uniform_int_distribution<uint8_t> distribution_u8(low, high); + fill(tensor, distribution_u8, seed_offset); + break; + } + case DataType::S8: + case DataType::QS8: + { + ARM_COMPUTE_ERROR_ON(!(std::is_same<int8_t, D>::value)); + std::uniform_int_distribution<int8_t> distribution_s8(low, high); + fill(tensor, distribution_s8, seed_offset); + break; + } + case DataType::U16: + { + ARM_COMPUTE_ERROR_ON(!(std::is_same<uint16_t, D>::value)); + std::uniform_int_distribution<uint16_t> distribution_u16(low, high); + fill(tensor, distribution_u16, seed_offset); + break; + } + case DataType::S16: + case DataType::QS16: + { + ARM_COMPUTE_ERROR_ON(!(std::is_same<int16_t, D>::value)); + std::uniform_int_distribution<int16_t> distribution_s16(low, high); + fill(tensor, distribution_s16, seed_offset); + break; + } + case DataType::U32: + { + ARM_COMPUTE_ERROR_ON(!(std::is_same<uint32_t, D>::value)); + std::uniform_int_distribution<uint32_t> distribution_u32(low, high); + fill(tensor, distribution_u32, seed_offset); + break; + } + case DataType::S32: + { + ARM_COMPUTE_ERROR_ON(!(std::is_same<int32_t, D>::value)); + std::uniform_int_distribution<int32_t> distribution_s32(low, high); + fill(tensor, distribution_s32, seed_offset); + break; + } + case DataType::U64: + { + ARM_COMPUTE_ERROR_ON(!(std::is_same<uint64_t, D>::value)); + std::uniform_int_distribution<uint64_t> distribution_u64(low, high); + fill(tensor, distribution_u64, seed_offset); + break; + } + case DataType::S64: + { + ARM_COMPUTE_ERROR_ON(!(std::is_same<int64_t, D>::value)); + std::uniform_int_distribution<int64_t> distribution_s64(low, high); + fill(tensor, distribution_s64, seed_offset); + break; + } + case DataType::F16: + { + std::uniform_real_distribution<float> distribution_f16(low, high); + fill(tensor, distribution_f16, seed_offset); + break; + } + case DataType::F32: + { + ARM_COMPUTE_ERROR_ON(!(std::is_same<float, D>::value)); + std::uniform_real_distribution<float> distribution_f32(low, high); + fill(tensor, distribution_f32, seed_offset); + break; + } + case DataType::F64: + { + ARM_COMPUTE_ERROR_ON(!(std::is_same<double, D>::value)); + std::uniform_real_distribution<double> distribution_f64(low, high); + fill(tensor, distribution_f64, seed_offset); + break; + } + case DataType::SIZET: + { + ARM_COMPUTE_ERROR_ON(!(std::is_same<size_t, D>::value)); + std::uniform_int_distribution<size_t> distribution_sizet(low, high); + fill(tensor, distribution_sizet, seed_offset); + break; + } + default: + ARM_COMPUTE_ERROR("NOT SUPPORTED!"); + } +} + +template <typename T> +void AssetsLibrary::fill_layer_data(T &&tensor, std::string name) const +{ +#ifdef _WIN32 + const std::string path_separator("\\"); +#else /* _WIN32 */ + const std::string path_separator("/"); +#endif /* _WIN32 */ + + const std::string path = _library_path + path_separator + name; + + // Open file + std::ifstream file(path, std::ios::in | std::ios::binary); + if(!file.good()) + { + throw std::runtime_error("Could not load binary data: " + path); + } + + Window window; + for(unsigned int d = 0; d < tensor.shape().num_dimensions(); ++d) + { + window.set(d, Window::Dimension(0, tensor.shape()[d], 1)); + } + + //FIXME : Replace with normal loop + execute_window_loop(window, [&](const Coordinates & id) + { + float val; + file.read(reinterpret_cast<char *>(&val), sizeof(float)); + void *const out_ptr = tensor(id); + store_value_with_data_type(out_ptr, val, tensor.data_type()); + }); +} +} // namespace test +} // namespace arm_compute +#endif /* __ARM_COMPUTE_TEST_TENSOR_LIBRARY_H__ */ diff --git a/tests/validation/CL/ArithmeticAddition.cpp b/tests/validation_old/CL/ArithmeticAddition.cpp index fc1bf5905d..8e67bf3a26 100644 --- a/tests/validation/CL/ArithmeticAddition.cpp +++ b/tests/validation_old/CL/ArithmeticAddition.cpp @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" +#include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -37,7 +37,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/CL/ArithmeticSubtraction.cpp b/tests/validation_old/CL/ArithmeticSubtraction.cpp index 086281cdda..522ee7b1e8 100644 --- a/tests/validation/CL/ArithmeticSubtraction.cpp +++ b/tests/validation_old/CL/ArithmeticSubtraction.cpp @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" +#include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -37,7 +37,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/CL/BatchNormalizationLayer.cpp b/tests/validation_old/CL/BatchNormalizationLayer.cpp index abcc619cb8..75c9a580ea 100644 --- a/tests/validation/CL/BatchNormalizationLayer.cpp +++ b/tests/validation_old/CL/BatchNormalizationLayer.cpp @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" -#include "Globals.h" #include "TypePrinter.h" #include "Utils.h" -#include "dataset/BatchNormalizationLayerDataset.h" -#include "tests/validation/Helpers.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Helpers.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/dataset/BatchNormalizationLayerDataset.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation/CL/Box3x3.cpp b/tests/validation_old/CL/Box3x3.cpp index f2df5e6511..3eacb484b2 100644 --- a/tests/validation/CL/Box3x3.cpp +++ b/tests/validation_old/CL/Box3x3.cpp @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" -#include "Globals.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -38,7 +38,7 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLBox3x3.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/CL/CLFixture.cpp b/tests/validation_old/CL/CLFixture.cpp index 38e52c31f6..aacaeb35b7 100644 --- a/tests/validation/CL/CLFixture.cpp +++ b/tests/validation_old/CL/CLFixture.cpp @@ -21,9 +21,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "validation/CL/CLFixture.h" +#include "tests/validation_old/CL/CLFixture.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" using namespace arm_compute; using namespace arm_compute::test; diff --git a/tests/validation/CL/CLFixture.h b/tests/validation_old/CL/CLFixture.h index 77538be8f4..77538be8f4 100644 --- a/tests/validation/CL/CLFixture.h +++ b/tests/validation_old/CL/CLFixture.h diff --git a/tests/validation/CL/DepthConvert.cpp b/tests/validation_old/CL/DepthConvert.cpp index 57a21e89c7..994a0327bf 100644 --- a/tests/validation/CL/DepthConvert.cpp +++ b/tests/validation_old/CL/DepthConvert.cpp @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" -#include "Globals.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -37,7 +37,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/CL/FillBorder.cpp b/tests/validation_old/CL/FillBorder.cpp index dc522c5c3b..ed47a1eeb3 100644 --- a/tests/validation/CL/FillBorder.cpp +++ b/tests/validation_old/CL/FillBorder.cpp @@ -21,13 +21,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" -#include "Globals.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/CL/kernels/CLFillBorderKernel.h" #include "arm_compute/core/Helpers.h" @@ -36,7 +36,7 @@ #include "arm_compute/runtime/CL/CLTensor.h" #include "arm_compute/runtime/CL/CLTensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/CL/FixedPoint/FixedPoint_QS8.cpp b/tests/validation_old/CL/FixedPoint/FixedPoint_QS8.cpp index d4ccc2ba2b..3721fb51d7 100644 --- a/tests/validation/CL/FixedPoint/FixedPoint_QS8.cpp +++ b/tests/validation_old/CL/FixedPoint/FixedPoint_QS8.cpp @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" -#include "Globals.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/CL/CLKernelLibrary.h" #include "arm_compute/core/CL/ICLKernel.h" @@ -43,7 +43,7 @@ #include "arm_compute/core/CL/ICLTensor.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/CL/Gaussian3x3.cpp b/tests/validation_old/CL/Gaussian3x3.cpp index 2ef077c005..27f4833289 100644 --- a/tests/validation/CL/Gaussian3x3.cpp +++ b/tests/validation_old/CL/Gaussian3x3.cpp @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" -#include "Globals.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -38,7 +38,7 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLGaussian3x3.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/CL/Gaussian5x5.cpp b/tests/validation_old/CL/Gaussian5x5.cpp index fb21ed06af..c187426f4c 100644 --- a/tests/validation/CL/Gaussian5x5.cpp +++ b/tests/validation_old/CL/Gaussian5x5.cpp @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" -#include "Globals.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -38,7 +38,7 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLGaussian5x5.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/CL/HarrisCorners.cpp b/tests/validation_old/CL/HarrisCorners.cpp index 6370c4d972..2c73679058 100644 --- a/tests/validation/CL/HarrisCorners.cpp +++ b/tests/validation_old/CL/HarrisCorners.cpp @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" -#include "Globals.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -39,7 +39,7 @@ #include "arm_compute/runtime/TensorAllocator.h" #include "PaddingCalculator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/CL/IntegralImage.cpp b/tests/validation_old/CL/IntegralImage.cpp index dc325a1f8a..ea15b90b2a 100644 --- a/tests/validation/CL/IntegralImage.cpp +++ b/tests/validation_old/CL/IntegralImage.cpp @@ -22,15 +22,15 @@ * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" -#include "Globals.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -38,7 +38,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/CL/MinMaxLocation.cpp b/tests/validation_old/CL/MinMaxLocation.cpp index 5f8be433cd..8824215223 100644 --- a/tests/validation/CL/MinMaxLocation.cpp +++ b/tests/validation_old/CL/MinMaxLocation.cpp @@ -22,14 +22,14 @@ * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" -#include "Globals.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -38,7 +38,7 @@ #include "arm_compute/runtime/TensorAllocator.h" #include "PaddingCalculator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/CL/NonLinearFilter.cpp b/tests/validation_old/CL/NonLinearFilter.cpp index f453f27e8a..0132f7db8c 100644 --- a/tests/validation/CL/NonLinearFilter.cpp +++ b/tests/validation_old/CL/NonLinearFilter.cpp @@ -21,17 +21,17 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" -#include "Globals.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Helpers.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Helpers.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -39,7 +39,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/CL/PixelWiseMultiplication.cpp b/tests/validation_old/CL/PixelWiseMultiplication.cpp index 375c77dedf..f003298a23 100644 --- a/tests/validation/CL/PixelWiseMultiplication.cpp +++ b/tests/validation_old/CL/PixelWiseMultiplication.cpp @@ -25,9 +25,9 @@ #include "TypePrinter.h" #include "tests/Globals.h" #include "tests/Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/runtime/CL/functions/CLPixelWiseMultiplication.h" diff --git a/tests/validation/CL/ROIPoolingLayer.cpp b/tests/validation_old/CL/ROIPoolingLayer.cpp index 19d7903128..edd1cccf2a 100644 --- a/tests/validation/CL/ROIPoolingLayer.cpp +++ b/tests/validation_old/CL/ROIPoolingLayer.cpp @@ -28,10 +28,10 @@ #include "arm_compute/runtime/CL/functions/CLROIPoolingLayer.h" #include "tests/Globals.h" #include "tests/Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include <random> #include <vector> diff --git a/tests/validation/CL/Sobel3x3.cpp b/tests/validation_old/CL/Sobel3x3.cpp index 9e32a3da66..a4c779cd5c 100644 --- a/tests/validation/CL/Sobel3x3.cpp +++ b/tests/validation_old/CL/Sobel3x3.cpp @@ -22,16 +22,16 @@ * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" -#include "Globals.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -40,7 +40,7 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLSobel3x3.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/CL/Sobel5x5.cpp b/tests/validation_old/CL/Sobel5x5.cpp index a7c971aa3a..7e5dec1209 100644 --- a/tests/validation/CL/Sobel5x5.cpp +++ b/tests/validation_old/CL/Sobel5x5.cpp @@ -22,16 +22,16 @@ * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" -#include "Globals.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -40,7 +40,7 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLSobel5x5.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/CL/TableLookup.cpp b/tests/validation_old/CL/TableLookup.cpp index 40e847f1cd..26c38689f0 100644 --- a/tests/validation/CL/TableLookup.cpp +++ b/tests/validation_old/CL/TableLookup.cpp @@ -21,18 +21,18 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" #include "CL/CLLutAccessor.h" -#include "Globals.h" #include "PaddingCalculator.h" #include "RawLutAccessor.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Helpers.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Helpers.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -40,7 +40,7 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLTableLookup.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <map> #include <random> diff --git a/tests/validation/CL/Threshold.cpp b/tests/validation_old/CL/Threshold.cpp index a2e7b7b4ba..74ddd6873e 100644 --- a/tests/validation/CL/Threshold.cpp +++ b/tests/validation_old/CL/Threshold.cpp @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" -#include "Globals.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "dataset/ThresholdDataset.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/dataset/ThresholdDataset.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -38,7 +38,7 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLThreshold.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/CL/WarpPerspective.cpp b/tests/validation_old/CL/WarpPerspective.cpp index 260b22be03..6252361003 100644 --- a/tests/validation/CL/WarpPerspective.cpp +++ b/tests/validation_old/CL/WarpPerspective.cpp @@ -21,17 +21,17 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" #include "CL/CLAccessor.h" -#include "Globals.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Helpers.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Helpers.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -39,7 +39,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/Datasets.h b/tests/validation_old/Datasets.h index 15e1b098e6..464fffd1cf 100644 --- a/tests/validation/Datasets.h +++ b/tests/validation_old/Datasets.h @@ -24,25 +24,25 @@ #ifndef __ARM_COMPUTE_TEST_VALIDATION_DATASETS_H__ #define __ARM_COMPUTE_TEST_VALIDATION_DATASETS_H__ -#include "dataset/ActivationFunctionDataset.h" -#include "dataset/BatchNormalizationLayerDataset.h" -#include "dataset/BorderModeDataset.h" -#include "dataset/ConvertPolicyDataset.h" -#include "dataset/ConvolutionLayerDataset.h" -#include "dataset/DataTypeDatasets.h" -#include "dataset/FullyConnectedLayerDataset.h" -#include "dataset/GEMMDataset.h" -#include "dataset/ImageDatasets.h" -#include "dataset/InterpolationPolicyDataset.h" -#include "dataset/MatrixPatternDataset.h" -#include "dataset/NonLinearFilterFunctionDataset.h" -#include "dataset/NormalizationTypeDataset.h" -#include "dataset/PoolingTypesDataset.h" -#include "dataset/RoundingPolicyDataset.h" -#include "dataset/ShapeDatasets.h" -#include "dataset/ThresholdDataset.h" - -#include "boost_wrapper.h" +#include "tests/validation_old/dataset/ActivationFunctionDataset.h" +#include "tests/validation_old/dataset/BatchNormalizationLayerDataset.h" +#include "tests/validation_old/dataset/BorderModeDataset.h" +#include "tests/validation_old/dataset/ConvertPolicyDataset.h" +#include "tests/validation_old/dataset/ConvolutionLayerDataset.h" +#include "tests/validation_old/dataset/DataTypeDatasets.h" +#include "tests/validation_old/dataset/FullyConnectedLayerDataset.h" +#include "tests/validation_old/dataset/GEMMDataset.h" +#include "tests/validation_old/dataset/ImageDatasets.h" +#include "tests/validation_old/dataset/InterpolationPolicyDataset.h" +#include "tests/validation_old/dataset/MatrixPatternDataset.h" +#include "tests/validation_old/dataset/NonLinearFilterFunctionDataset.h" +#include "tests/validation_old/dataset/NormalizationTypeDataset.h" +#include "tests/validation_old/dataset/PoolingTypesDataset.h" +#include "tests/validation_old/dataset/RoundingPolicyDataset.h" +#include "tests/validation_old/dataset/ShapeDatasets.h" +#include "tests/validation_old/dataset/ThresholdDataset.h" + +#include "tests/validation_old/boost_wrapper.h" using namespace boost::unit_test::data::monomorphic; diff --git a/tests/validation_new/FixedPoint.h b/tests/validation_old/FixedPoint.h index 61d791c54c..12ffcdfc3d 100644 --- a/tests/validation_new/FixedPoint.h +++ b/tests/validation_old/FixedPoint.h @@ -63,8 +63,6 @@ template <> struct promote<uint32_t> { using type = uint64_t; }; template <> struct promote<int32_t> { using type = int64_t; }; template <> struct promote<uint64_t> { using type = uint64_t; }; template <> struct promote<int64_t> { using type = int64_t; }; -template <typename T> -using promote_t = typename promote<T>::type; // clang-format on // *INDENT-ON* } @@ -90,6 +88,10 @@ public: // Static Checks static_assert(std::is_integral<T>::value, "Type is not an integer"); + // Friends + friend struct detail::functions; + friend struct detail::constant_expr<T>; + /** Constructor (from different fixed point type) * * @param[in] val Fixed point @@ -385,7 +387,7 @@ struct functions template <typename T> static bool signbit(fixed_point<T> x) { - return ((x.raw() >> std::numeric_limits<T>::digits) != 0); + return ((x._value >> std::numeric_limits<T>::digits) != 0); } /** Checks if two fixed point numbers are equal * @@ -397,10 +399,10 @@ struct functions template <typename T> static bool isequal(fixed_point<T> x, fixed_point<T> y) { - uint8_t p = std::min(x.precision(), y.precision()); + uint8_t p = std::min(x._fixed_point_position, y._fixed_point_position); x.rescale(p); y.rescale(p); - return (x.raw() == y.raw()); + return (x._value == y._value); } /** Checks if two fixed point number are not equal * @@ -424,10 +426,10 @@ struct functions template <typename T> static bool isgreater(fixed_point<T> x, fixed_point<T> y) { - uint8_t p = std::min(x.precision(), y.precision()); + uint8_t p = std::min(x._fixed_point_position, y._fixed_point_position); x.rescale(p); y.rescale(p); - return (x.raw() > y.raw()); + return (x._value > y._value); } /** Checks if one fixed point is greater or equal than the other * @@ -439,10 +441,10 @@ struct functions template <typename T> static bool isgreaterequal(fixed_point<T> x, fixed_point<T> y) { - uint8_t p = std::min(x.precision(), y.precision()); + uint8_t p = std::min(x._fixed_point_position, y._fixed_point_position); x.rescale(p); y.rescale(p); - return (x.raw() >= y.raw()); + return (x._value >= y._value); } /** Checks if one fixed point is less than the other * @@ -454,10 +456,10 @@ struct functions template <typename T> static bool isless(fixed_point<T> x, fixed_point<T> y) { - uint8_t p = std::min(x.precision(), y.precision()); + uint8_t p = std::min(x._fixed_point_position, y._fixed_point_position); x.rescale(p); y.rescale(p); - return (x.raw() < y.raw()); + return (x._value < y._value); } /** Checks if one fixed point is less or equal than the other * @@ -469,10 +471,10 @@ struct functions template <typename T> static bool islessequal(fixed_point<T> x, fixed_point<T> y) { - uint8_t p = std::min(x.precision(), y.precision()); + uint8_t p = std::min(x._fixed_point_position, y._fixed_point_position); x.rescale(p); y.rescale(p); - return (x.raw() <= y.raw()); + return (x._value <= y._value); } /** Checks if one fixed point is less or greater than the other * @@ -497,7 +499,7 @@ struct functions template <typename T> static fixed_point<T> clamp(fixed_point<T> x, T min, T max) { - return fixed_point<T>(constant_expr<T>::clamp(x.raw(), min, max), x.precision(), true); + return fixed_point<T>(constant_expr<T>::clamp(x._value, min, max), x._fixed_point_position, true); } /** Negate number * @@ -509,12 +511,12 @@ struct functions static fixed_point<T> negate(fixed_point<T> x) { using promoted_T = typename traits::promote<T>::type; - promoted_T val = -x.raw(); + promoted_T val = -x._value; if(OP == OverflowPolicy::SATURATE) { val = constant_expr<T>::saturate_cast(val); } - return fixed_point<T>(static_cast<T>(val), x.precision(), true); + return fixed_point<T>(static_cast<T>(val), x._fixed_point_position, true); } /** Perform addition among two fixed point numbers * @@ -526,19 +528,19 @@ struct functions template <OverflowPolicy OP = OverflowPolicy::SATURATE, typename T> static fixed_point<T> add(fixed_point<T> x, fixed_point<T> y) { - uint8_t p = std::min(x.precision(), y.precision()); + uint8_t p = std::min(x._fixed_point_position, y._fixed_point_position); x.rescale(p); y.rescale(p); if(OP == OverflowPolicy::SATURATE) { using type = typename traits::promote<T>::type; - type val = static_cast<type>(x.raw()) + static_cast<type>(y.raw()); + type val = static_cast<type>(x._value) + static_cast<type>(y._value); val = constant_expr<T>::saturate_cast(val); return fixed_point<T>(static_cast<T>(val), p, true); } else { - return fixed_point<T>(x.raw() + y.raw(), p, true); + return fixed_point<T>(x._value + y._value, p, true); } } /** Perform subtraction among two fixed point numbers @@ -551,19 +553,19 @@ struct functions template <OverflowPolicy OP = OverflowPolicy::SATURATE, typename T> static fixed_point<T> sub(fixed_point<T> x, fixed_point<T> y) { - uint8_t p = std::min(x.precision(), y.precision()); + uint8_t p = std::min(x._fixed_point_position, y._fixed_point_position); x.rescale(p); y.rescale(p); if(OP == OverflowPolicy::SATURATE) { using type = typename traits::promote<T>::type; - type val = static_cast<type>(x.raw()) - static_cast<type>(y.raw()); + type val = static_cast<type>(x._value) - static_cast<type>(y._value); val = constant_expr<T>::saturate_cast(val); return fixed_point<T>(static_cast<T>(val), p, true); } else { - return fixed_point<T>(x.raw() - y.raw(), p, true); + return fixed_point<T>(x._value - y._value, p, true); } } /** Perform multiplication among two fixed point numbers @@ -577,10 +579,10 @@ struct functions static fixed_point<T> mul(fixed_point<T> x, fixed_point<T> y) { using promoted_T = typename traits::promote<T>::type; - uint8_t p_min = std::min(x.precision(), y.precision()); - uint8_t p_max = std::max(x.precision(), y.precision()); + uint8_t p_min = std::min(x._fixed_point_position, y._fixed_point_position); + uint8_t p_max = std::max(x._fixed_point_position, y._fixed_point_position); promoted_T round_factor = (1 << (p_max - 1)); - promoted_T val = ((static_cast<promoted_T>(x.raw()) * static_cast<promoted_T>(y.raw())) + round_factor) >> p_max; + promoted_T val = ((static_cast<promoted_T>(x._value) * static_cast<promoted_T>(y._value)) + round_factor) >> p_max; if(OP == OverflowPolicy::SATURATE) { val = constant_expr<T>::saturate_cast(val); @@ -598,11 +600,11 @@ struct functions static fixed_point<T> div(fixed_point<T> x, fixed_point<T> y) { using promoted_T = typename traits::promote<T>::type; - uint8_t p = std::min(x.precision(), y.precision()); - promoted_T denom = static_cast<promoted_T>(y.raw()); + uint8_t p = std::min(x._fixed_point_position, y._fixed_point_position); + promoted_T denom = static_cast<promoted_T>(y._value); if(denom != 0) { - promoted_T val = (static_cast<promoted_T>(x.raw()) << std::max(x.precision(), y.precision())) / denom; + promoted_T val = (static_cast<promoted_T>(x._value) << std::max(x._fixed_point_position, y._fixed_point_position)) / denom; if(OP == OverflowPolicy::SATURATE) { val = constant_expr<T>::saturate_cast(val); @@ -611,7 +613,7 @@ struct functions } else { - T val = (x.raw() < 0) ? std::numeric_limits<T>::min() : std::numeric_limits<T>::max(); + T val = (x._value < 0) ? std::numeric_limits<T>::min() : std::numeric_limits<T>::max(); return fixed_point<T>(val, p, true); } } @@ -626,12 +628,12 @@ struct functions static fixed_point<T> shift_left(fixed_point<T> x, size_t shift) { using promoted_T = typename traits::promote<T>::type; - promoted_T val = static_cast<promoted_T>(x.raw()) << shift; + promoted_T val = static_cast<promoted_T>(x._value) << shift; if(OP == OverflowPolicy::SATURATE) { val = constant_expr<T>::saturate_cast(val); } - return fixed_point<T>(static_cast<T>(val), x.precision(), true); + return fixed_point<T>(static_cast<T>(val), x._fixed_point_position, true); } /** Shift right * @@ -643,7 +645,7 @@ struct functions template <typename T> static fixed_point<T> shift_right(fixed_point<T> x, size_t shift) { - return fixed_point<T>(x.raw() >> shift, x.precision(), true); + return fixed_point<T>(x._value >> shift, x._fixed_point_position, true); } /** Calculate absolute value * @@ -655,8 +657,8 @@ struct functions static fixed_point<T> abs(fixed_point<T> x) { using promoted_T = typename traits::promote<T>::type; - T val = (x.raw() < 0) ? constant_expr<T>::saturate_cast(-static_cast<promoted_T>(x.raw())) : x.raw(); - return fixed_point<T>(val, x.precision(), true); + T val = (x._value < 0) ? constant_expr<T>::saturate_cast(-static_cast<promoted_T>(x._value)) : x._value; + return fixed_point<T>(val, x._fixed_point_position, true); } /** Calculate the logarithm of a fixed point number * @@ -667,7 +669,7 @@ struct functions template <typename T> static fixed_point<T> log(fixed_point<T> x) { - uint8_t p = x.precision(); + uint8_t p = x._fixed_point_position; auto const_one = fixed_point<T>(static_cast<T>(1), p); // Logarithm of 1 is zero and logarithm of negative values is not defined in R, so return 0. @@ -682,7 +684,7 @@ struct functions } // Remove even powers of 2 - T shift_val = 31 - __builtin_clz(x.raw() >> p); + T shift_val = 31 - __builtin_clz(x._value >> p); x = shift_right(x, shift_val); x = sub(x, const_one); @@ -714,7 +716,7 @@ struct functions template <typename T> static fixed_point<T> exp(fixed_point<T> x) { - uint8_t p = x.precision(); + uint8_t p = x._fixed_point_position; // Constants auto const_one = fixed_point<T>(1, p); auto ln2 = fixed_point<T>(0.6931471, p); @@ -724,7 +726,7 @@ struct functions auto C = fixed_point<T>(0.1763723, p); auto D = fixed_point<T>(0.0435108, p); - T scaled_int_part = detail::constant_expr<T>::to_int(mul(x, inv_ln2).raw(), p); + T scaled_int_part = detail::constant_expr<T>::to_int(mul(x, inv_ln2)._value, p); // Polynomial expansion auto frac_part = sub(x, mul(ln2, fixed_point<T>(scaled_int_part, p))); @@ -751,8 +753,8 @@ struct functions template <typename T> static fixed_point<T> inv_sqrt(fixed_point<T> x) { - const uint8_t p = x.precision(); - int8_t shift = std::numeric_limits<T>::digits - (p + detail::clz(x.raw())); + const uint8_t p = x._fixed_point_position; + int8_t shift = std::numeric_limits<T>::digits - (p + detail::clz(x._value)); shift += std::numeric_limits<T>::is_signed ? 1 : 0; @@ -782,7 +784,7 @@ struct functions template <typename T> static fixed_point<T> tanh(fixed_point<T> x) { - uint8_t p = x.precision(); + uint8_t p = x._fixed_point_position; // Constants auto const_one = fixed_point<T>(1, p); auto const_two = fixed_point<T>(2, p); diff --git a/tests/validation_old/Helpers.h b/tests/validation_old/Helpers.h new file mode 100644 index 0000000000..e109edee2a --- /dev/null +++ b/tests/validation_old/Helpers.h @@ -0,0 +1,273 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef __ARM_COMPUTE_TEST_VALIDATION_HELPERS_H__ +#define __ARM_COMPUTE_TEST_VALIDATION_HELPERS_H__ + +#include "arm_compute/core/Types.h" +#include "tests/Globals.h" +#include "tests/ILutAccessor.h" +#include "tests/Types.h" +#include "tests/validation_old/ValidationUserConfiguration.h" +#include "tests/validation_old/half.h" + +#include <array> +#include <cstring> +#include <random> +#include <type_traits> +#include <utility> +#include <vector> + +namespace arm_compute +{ +namespace test +{ +namespace validation +{ +/** Helper function to fill one or more tensors with the uniform distribution with int values. + * + * @param[in] dist Distribution to be used to get the values for the tensor. + * @param[in] seeds List of seeds to be used to fill each tensor. + * @param[in,out] tensor Tensor to be initialized with the values of the distribution. + * @param[in,out] other_tensors (Optional) One or more tensors to be filled. + * + */ +template <typename D, typename T, typename... Ts> +void fill_tensors(D &&dist, std::initializer_list<int> seeds, T &&tensor, Ts &&... other_tensors) +{ + const std::array < T, 1 + sizeof...(Ts) > tensors{ { std::forward<T>(tensor), std::forward<Ts>(other_tensors)... } }; + std::vector<int> vs(seeds); + ARM_COMPUTE_ERROR_ON(vs.size() != tensors.size()); + int k = 0; + for(auto tp : tensors) + { + library->fill(*tp, std::forward<D>(dist), vs[k++]); + } +} + +/** Helper function to get the testing range for each activation layer. + * + * @param[in] activation Activation function to test. + * @param[in] fixed_point_position (Optional) Number of bits for the fractional part. Defaults to 1. + * + * @return A pair containing the lower upper testing bounds for a given function. + */ +template <typename T> +inline std::pair<T, T> get_activation_layer_test_bounds(ActivationLayerInfo::ActivationFunction activation, int fixed_point_position = 1) +{ + bool is_float = std::is_same<T, float>::value; + is_float = is_float || std::is_same<T, half_float::half>::value; + + std::pair<T, T> bounds; + + // Set initial values + if(is_float) + { + bounds = std::make_pair(-255.f, 255.f); + } + else + { + bounds = std::make_pair(std::numeric_limits<T>::lowest(), std::numeric_limits<T>::max()); + } + + // Reduce testing ranges + switch(activation) + { + case ActivationLayerInfo::ActivationFunction::LOGISTIC: + case ActivationLayerInfo::ActivationFunction::SOFT_RELU: + // Reduce range as exponent overflows + if(is_float) + { + bounds.first = -40.f; + bounds.second = 40.f; + } + else + { + bounds.first = -(1 << (fixed_point_position)); + bounds.second = 1 << (fixed_point_position); + } + break; + case ActivationLayerInfo::ActivationFunction::TANH: + // Reduce range as exponent overflows + if(!is_float) + { + bounds.first = -(1 << (fixed_point_position)); + bounds.second = 1 << (fixed_point_position); + } + break; + case ActivationLayerInfo::ActivationFunction::SQRT: + // Reduce range as sqrt should take a non-negative number + bounds.first = (is_float) ? 0 : 1; + break; + default: + break; + } + return bounds; +} +/** Helper function to get the testing range for batch normalization layer. + * + * @param[in] fixed_point_position (Optional) Number of bits for the fractional part. Defaults to 1. + * + * @return A pair containing the lower upper testing bounds. + */ +template <typename T> +std::pair<T, T> get_batchnormalization_layer_test_bounds(int fixed_point_position = 1) +{ + bool is_float = std::is_floating_point<T>::value; + std::pair<T, T> bounds; + + // Set initial values + if(is_float) + { + bounds = std::make_pair(-1.f, 1.f); + } + else + { + bounds = std::make_pair(1, 1 << (fixed_point_position)); + } + + return bounds; +} + +/** Fill mask with the corresponding given pattern. + * + * @param[in,out] mask Mask to be filled according to pattern + * @param[in] cols Columns (width) of mask + * @param[in] rows Rows (height) of mask + * @param[in] pattern Pattern to fill the mask according to + */ +inline void fill_mask_from_pattern(uint8_t *mask, int cols, int rows, MatrixPattern pattern) +{ + unsigned int v = 0; + std::mt19937 gen(user_config.seed.get()); + std::bernoulli_distribution dist(0.5); + + for(int r = 0; r < rows; ++r) + { + for(int c = 0; c < cols; ++c, ++v) + { + uint8_t val = 0; + + switch(pattern) + { + case MatrixPattern::BOX: + val = 255; + break; + case MatrixPattern::CROSS: + val = ((r == (rows / 2)) || (c == (cols / 2))) ? 255 : 0; + break; + case MatrixPattern::DISK: + val = (((r - rows / 2.0f + 0.5f) * (r - rows / 2.0f + 0.5f)) / ((rows / 2.0f) * (rows / 2.0f)) + ((c - cols / 2.0f + 0.5f) * (c - cols / 2.0f + 0.5f)) / ((cols / 2.0f) * + (cols / 2.0f))) <= 1.0f ? 255 : 0; + break; + case MatrixPattern::OTHER: + val = (dist(gen) ? 0 : 255); + break; + default: + return; + } + + mask[v] = val; + } + } + + if(pattern == MatrixPattern::OTHER) + { + std::uniform_int_distribution<uint8_t> distribution_u8(0, ((cols * rows) - 1)); + mask[distribution_u8(gen)] = 255; + } +} + +/** Calculate output tensor shape give a vector of input tensor to concatenate + * + * @param[in] input_shapes Shapes of the tensors to concatenate across depth. + * + * @return The shape of output concatenated tensor. + */ +inline TensorShape calculate_depth_concatenate_shape(std::vector<TensorShape> input_shapes) +{ + TensorShape out_shape = input_shapes.at(0); + + unsigned int max_x = 0; + unsigned int max_y = 0; + unsigned int depth = 0; + + for(auto const &shape : input_shapes) + { + max_x = std::max<unsigned int>(shape.x(), max_x); + max_y = std::max<unsigned int>(shape.y(), max_y); + depth += shape.z(); + } + + out_shape.set(0, max_x); + out_shape.set(1, max_y); + out_shape.set(2, depth); + + return out_shape; +} + +/** Fill matrix random. + * + * @param[in,out] matrix Matrix + * @param[in] cols Columns (width) of matrix + * @param[in] rows Rows (height) of matrix + */ +template <std::size_t SIZE> +inline void fill_warp_matrix(std::array<float, SIZE> &matrix, int cols, int rows) +{ + std::mt19937 gen(user_config.seed.get()); + std::uniform_real_distribution<float> dist(-1, 1); + + for(int v = 0, r = 0; r < rows; ++r) + { + for(int c = 0; c < cols; ++c, ++v) + { + matrix[v] = dist(gen); + } + } + if(SIZE == 9) + { + matrix[(cols * rows) - 1] = 1; + } +} + +/** Helper function to fill the Lut random by a ILutAccessor. + * + * @param[in,out] table Accessor at the Lut. + * + */ +template <typename T> +void fill_lookuptable(T &&table) +{ + std::mt19937 generator(user_config.seed.get()); + std::uniform_int_distribution<typename T::value_type> distribution(std::numeric_limits<typename T::value_type>::min(), std::numeric_limits<typename T::value_type>::max()); + + for(int i = std::numeric_limits<typename T::value_type>::min(); i <= std::numeric_limits<typename T::value_type>::max(); i++) + { + table[i] = distribution(generator); + } +} +} // namespace validation +} // namespace test +} // namespace arm_compute +#endif /* __ARM_COMPUTE_TEST_VALIDATION_HELPERS_H__ */ diff --git a/tests/validation/NEON/AbsoluteDifference.cpp b/tests/validation_old/NEON/AbsoluteDifference.cpp index 1aee95e2d8..aa866fff49 100644 --- a/tests/validation/NEON/AbsoluteDifference.cpp +++ b/tests/validation_old/NEON/AbsoluteDifference.cpp @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -37,7 +37,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/Accumulate.cpp b/tests/validation_old/NEON/Accumulate.cpp index 7e8a85065e..eb680a383d 100644 --- a/tests/validation/NEON/Accumulate.cpp +++ b/tests/validation_old/NEON/Accumulate.cpp @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -37,7 +37,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/AccumulateSquared.cpp b/tests/validation_old/NEON/AccumulateSquared.cpp index 83908425be..29b5edf41b 100644 --- a/tests/validation/NEON/AccumulateSquared.cpp +++ b/tests/validation_old/NEON/AccumulateSquared.cpp @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -37,7 +37,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/AccumulateWeighted.cpp b/tests/validation_old/NEON/AccumulateWeighted.cpp index ea71959c0b..c59c1edbc8 100644 --- a/tests/validation/NEON/AccumulateWeighted.cpp +++ b/tests/validation_old/NEON/AccumulateWeighted.cpp @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -37,7 +37,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/ArithmeticAddition.cpp b/tests/validation_old/NEON/ArithmeticAddition.cpp index 952dcd207b..490f124422 100644 --- a/tests/validation/NEON/ArithmeticAddition.cpp +++ b/tests/validation_old/NEON/ArithmeticAddition.cpp @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -37,7 +37,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/ArithmeticSubtraction.cpp b/tests/validation_old/NEON/ArithmeticSubtraction.cpp index b95bc05d75..86aa124f00 100644 --- a/tests/validation/NEON/ArithmeticSubtraction.cpp +++ b/tests/validation_old/NEON/ArithmeticSubtraction.cpp @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -37,7 +37,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/BatchNormalizationLayer.cpp b/tests/validation_old/NEON/BatchNormalizationLayer.cpp index 9898beb7db..d98f99a63c 100644 --- a/tests/validation/NEON/BatchNormalizationLayer.cpp +++ b/tests/validation_old/NEON/BatchNormalizationLayer.cpp @@ -23,14 +23,14 @@ */ #include "NEON/Accessor.h" #include "TypePrinter.h" -#include "dataset/BatchNormalizationLayerDataset.h" #include "tests/Globals.h" #include "tests/NEON/Helper.h" #include "tests/Utils.h" -#include "tests/validation/Helpers.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Helpers.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/dataset/BatchNormalizationLayerDataset.h" #include "arm_compute/runtime/NEON/functions/NEBatchNormalizationLayer.h" diff --git a/tests/validation/NEON/Box3x3.cpp b/tests/validation_old/NEON/Box3x3.cpp index 579b2c8af1..708b7de204 100644 --- a/tests/validation/NEON/Box3x3.cpp +++ b/tests/validation_old/NEON/Box3x3.cpp @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -39,7 +39,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/DepthConvert.cpp b/tests/validation_old/NEON/DepthConvert.cpp index 0b7a175f4f..48a2b6d3f0 100644 --- a/tests/validation/NEON/DepthConvert.cpp +++ b/tests/validation_old/NEON/DepthConvert.cpp @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -37,7 +37,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/FillBorder.cpp b/tests/validation_old/NEON/FillBorder.cpp index ef2c1ff6f8..ad703d97fb 100644 --- a/tests/validation/NEON/FillBorder.cpp +++ b/tests/validation_old/NEON/FillBorder.cpp @@ -21,13 +21,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/kernels/NEFillBorderKernel.h" @@ -35,7 +35,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/Fixedpoint/Exp_QS16.cpp b/tests/validation_old/NEON/Fixedpoint/Exp_QS16.cpp index dc8603c963..66115879aa 100644 --- a/tests/validation/NEON/Fixedpoint/Exp_QS16.cpp +++ b/tests/validation_old/NEON/Fixedpoint/Exp_QS16.cpp @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/ReferenceCPP.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/ReferenceCPP.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/NEFixedPoint.h" @@ -36,7 +36,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/Fixedpoint/Exp_QS8.cpp b/tests/validation_old/NEON/Fixedpoint/Exp_QS8.cpp index dae01db41e..9e8096fa75 100644 --- a/tests/validation/NEON/Fixedpoint/Exp_QS8.cpp +++ b/tests/validation_old/NEON/Fixedpoint/Exp_QS8.cpp @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/ReferenceCPP.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/ReferenceCPP.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/NEFixedPoint.h" @@ -36,7 +36,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/Fixedpoint/Invsqrt_QS16.cpp b/tests/validation_old/NEON/Fixedpoint/Invsqrt_QS16.cpp index 4306a9a8ba..f56707a93d 100644 --- a/tests/validation/NEON/Fixedpoint/Invsqrt_QS16.cpp +++ b/tests/validation_old/NEON/Fixedpoint/Invsqrt_QS16.cpp @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/ReferenceCPP.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/ReferenceCPP.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/NEFixedPoint.h" @@ -36,7 +36,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/Fixedpoint/Invsqrt_QS8.cpp b/tests/validation_old/NEON/Fixedpoint/Invsqrt_QS8.cpp index 1a2acaf34b..fb33fd4632 100644 --- a/tests/validation/NEON/Fixedpoint/Invsqrt_QS8.cpp +++ b/tests/validation_old/NEON/Fixedpoint/Invsqrt_QS8.cpp @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/ReferenceCPP.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/ReferenceCPP.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/NEFixedPoint.h" @@ -36,7 +36,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/Fixedpoint/Log_QS16.cpp b/tests/validation_old/NEON/Fixedpoint/Log_QS16.cpp index 71582d8f96..6485b2031c 100644 --- a/tests/validation/NEON/Fixedpoint/Log_QS16.cpp +++ b/tests/validation_old/NEON/Fixedpoint/Log_QS16.cpp @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/ReferenceCPP.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/ReferenceCPP.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/NEFixedPoint.h" @@ -36,7 +36,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/Fixedpoint/Log_QS8.cpp b/tests/validation_old/NEON/Fixedpoint/Log_QS8.cpp index cc74d12e10..21012c52b0 100644 --- a/tests/validation/NEON/Fixedpoint/Log_QS8.cpp +++ b/tests/validation_old/NEON/Fixedpoint/Log_QS8.cpp @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/ReferenceCPP.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/ReferenceCPP.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/NEFixedPoint.h" @@ -36,7 +36,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/Fixedpoint/Reciprocal_QS16.cpp b/tests/validation_old/NEON/Fixedpoint/Reciprocal_QS16.cpp index 2081948d6c..5630a3391a 100644 --- a/tests/validation/NEON/Fixedpoint/Reciprocal_QS16.cpp +++ b/tests/validation_old/NEON/Fixedpoint/Reciprocal_QS16.cpp @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/ReferenceCPP.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/ReferenceCPP.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/NEFixedPoint.h" @@ -36,7 +36,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/Fixedpoint/Reciprocal_QS8.cpp b/tests/validation_old/NEON/Fixedpoint/Reciprocal_QS8.cpp index 4b808ce3e0..23f98acc40 100644 --- a/tests/validation/NEON/Fixedpoint/Reciprocal_QS8.cpp +++ b/tests/validation_old/NEON/Fixedpoint/Reciprocal_QS8.cpp @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/ReferenceCPP.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/ReferenceCPP.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/NEFixedPoint.h" @@ -36,7 +36,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/Gaussian3x3.cpp b/tests/validation_old/NEON/Gaussian3x3.cpp index b7f9150283..becd9196ea 100644 --- a/tests/validation/NEON/Gaussian3x3.cpp +++ b/tests/validation_old/NEON/Gaussian3x3.cpp @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -39,7 +39,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/Gaussian5x5.cpp b/tests/validation_old/NEON/Gaussian5x5.cpp index 7727340f66..240285afb6 100644 --- a/tests/validation/NEON/Gaussian5x5.cpp +++ b/tests/validation_old/NEON/Gaussian5x5.cpp @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -39,7 +39,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/HarrisCorners.cpp b/tests/validation_old/NEON/HarrisCorners.cpp index 6793e21c34..809e61c053 100644 --- a/tests/validation/NEON/HarrisCorners.cpp +++ b/tests/validation_old/NEON/HarrisCorners.cpp @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "NEON/Helper.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -39,7 +39,7 @@ #include "arm_compute/runtime/TensorAllocator.h" #include "PaddingCalculator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/IntegralImage.cpp b/tests/validation_old/NEON/IntegralImage.cpp index d5ad33e2a5..69654b2585 100644 --- a/tests/validation/NEON/IntegralImage.cpp +++ b/tests/validation_old/NEON/IntegralImage.cpp @@ -22,15 +22,15 @@ * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -38,7 +38,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/MinMaxLocation.cpp b/tests/validation_old/NEON/MinMaxLocation.cpp index a467172550..c41745a636 100644 --- a/tests/validation/NEON/MinMaxLocation.cpp +++ b/tests/validation_old/NEON/MinMaxLocation.cpp @@ -22,16 +22,16 @@ * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "NEON/Helper.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -39,7 +39,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/NonLinearFilter.cpp b/tests/validation_old/NEON/NonLinearFilter.cpp index ff0a8e71f2..acc90a436a 100644 --- a/tests/validation/NEON/NonLinearFilter.cpp +++ b/tests/validation_old/NEON/NonLinearFilter.cpp @@ -21,17 +21,17 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Helpers.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Helpers.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -39,7 +39,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/PixelWiseMultiplication.cpp b/tests/validation_old/NEON/PixelWiseMultiplication.cpp index f80944821c..60eb82ef84 100644 --- a/tests/validation/NEON/PixelWiseMultiplication.cpp +++ b/tests/validation_old/NEON/PixelWiseMultiplication.cpp @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -37,7 +37,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/ROIPoolingLayer.cpp b/tests/validation_old/NEON/ROIPoolingLayer.cpp index 523885d908..2046beb196 100644 --- a/tests/validation/NEON/ROIPoolingLayer.cpp +++ b/tests/validation_old/NEON/ROIPoolingLayer.cpp @@ -27,10 +27,10 @@ #include "arm_compute/runtime/NEON/functions/NEROIPoolingLayer.h" #include "tests/Globals.h" #include "tests/Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include <random> #include <vector> diff --git a/tests/validation/NEON/Sobel3x3.cpp b/tests/validation_old/NEON/Sobel3x3.cpp index 74a3144de4..cb249e1a58 100644 --- a/tests/validation/NEON/Sobel3x3.cpp +++ b/tests/validation_old/NEON/Sobel3x3.cpp @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -38,7 +38,7 @@ #include "arm_compute/runtime/TensorAllocator.h" #include "PaddingCalculator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/Sobel5x5.cpp b/tests/validation_old/NEON/Sobel5x5.cpp index d4d48f6afa..2f26e62e83 100644 --- a/tests/validation/NEON/Sobel5x5.cpp +++ b/tests/validation_old/NEON/Sobel5x5.cpp @@ -22,16 +22,16 @@ * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -39,7 +39,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/TableLookup.cpp b/tests/validation_old/NEON/TableLookup.cpp index 70b767eb16..f134e5d417 100644 --- a/tests/validation/NEON/TableLookup.cpp +++ b/tests/validation_old/NEON/TableLookup.cpp @@ -21,8 +21,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "NEON/Helper.h" #include "NEON/LutAccessor.h" @@ -30,10 +28,12 @@ #include "RawLutAccessor.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Helpers.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Helpers.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -41,7 +41,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/Threshold.cpp b/tests/validation_old/NEON/Threshold.cpp index f5382d4bfa..d56ec5eb42 100644 --- a/tests/validation/NEON/Threshold.cpp +++ b/tests/validation_old/NEON/Threshold.cpp @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "dataset/ThresholdDataset.h" -#include "validation/Datasets.h" -#include "validation/Reference.h" -#include "validation/Validation.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/dataset/ThresholdDataset.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -38,7 +38,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/validation/NEON/WarpPerspective.cpp b/tests/validation_old/NEON/WarpPerspective.cpp index 2c102ea37e..5a15591261 100644 --- a/tests/validation/NEON/WarpPerspective.cpp +++ b/tests/validation_old/NEON/WarpPerspective.cpp @@ -21,17 +21,17 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "AssetsLibrary.h" -#include "Globals.h" #include "NEON/Accessor.h" #include "PaddingCalculator.h" #include "TypePrinter.h" #include "Utils.h" -#include "validation/Datasets.h" -#include "validation/Helpers.h" -#include "validation/Reference.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Datasets.h" +#include "tests/validation_old/Helpers.h" +#include "tests/validation_old/Reference.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" @@ -39,7 +39,7 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <random> #include <string> diff --git a/tests/ProgramOptions.cpp b/tests/validation_old/ProgramOptions.cpp index b5a7bb14ad..b5a7bb14ad 100644 --- a/tests/ProgramOptions.cpp +++ b/tests/validation_old/ProgramOptions.cpp diff --git a/tests/ProgramOptions.h b/tests/validation_old/ProgramOptions.h index 0b28355aa6..0b28355aa6 100644 --- a/tests/ProgramOptions.h +++ b/tests/validation_old/ProgramOptions.h diff --git a/tests/validation_old/RawTensor.cpp b/tests/validation_old/RawTensor.cpp new file mode 100644 index 0000000000..bc2747d2a1 --- /dev/null +++ b/tests/validation_old/RawTensor.cpp @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "RawTensor.h" + +namespace arm_compute +{ +namespace test +{ +RawTensor::RawTensor(TensorShape shape, Format format, int fixed_point_position) + : SimpleTensor(shape, format, fixed_point_position) +{ + _buffer = support::cpp14::make_unique<uint8_t[]>(SimpleTensor::num_elements() * SimpleTensor::num_channels() * SimpleTensor::element_size()); +} + +RawTensor::RawTensor(TensorShape shape, DataType data_type, int num_channels, int fixed_point_position) + : SimpleTensor(shape, data_type, num_channels, fixed_point_position) +{ + _buffer = support::cpp14::make_unique<uint8_t[]>(SimpleTensor::num_elements() * SimpleTensor::num_channels() * SimpleTensor::element_size()); +} + +RawTensor::RawTensor(const RawTensor &tensor) + : SimpleTensor(tensor.shape(), tensor.data_type(), tensor.num_channels(), tensor.fixed_point_position()) +{ + _format = tensor.format(); + _buffer = support::cpp14::make_unique<uint8_t[]>(num_elements() * num_channels() * element_size()); + std::copy_n(tensor.data(), num_elements() * num_channels() * element_size(), _buffer.get()); +} + +RawTensor &RawTensor::operator=(RawTensor tensor) +{ + swap(*this, tensor); + + return *this; +} + +const void *RawTensor::operator()(const Coordinates &coord) const +{ + return _buffer.get() + coord2index(_shape, coord) * element_size(); +} + +void *RawTensor::operator()(const Coordinates &coord) +{ + return _buffer.get() + coord2index(_shape, coord) * element_size(); +} +} // namespace test +} // namespace arm_compute diff --git a/tests/validation_old/RawTensor.h b/tests/validation_old/RawTensor.h new file mode 100644 index 0000000000..fd0ab2b9fd --- /dev/null +++ b/tests/validation_old/RawTensor.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef __ARM_COMPUTE_TEST_RAW_TENSOR_H__ +#define __ARM_COMPUTE_TEST_RAW_TENSOR_H__ + +#include "tests/SimpleTensor.h" + +namespace arm_compute +{ +namespace test +{ +/** Subclass of SimpleTensor using uint8_t as value type. + * + * Access operations (except for operator[]) will be based on the data type to + * copy the right number of elements. + */ +class RawTensor : public SimpleTensor<uint8_t> +{ +public: + /** Create an uninitialised tensor of the given @p shape and @p format. + * + * @param[in] shape Shape of the new raw tensor. + * @param[in] format Format of the new raw tensor. + * @param[in] fixed_point_position (Optional) Number of bits for the fractional part of the fixed point numbers + */ + RawTensor(TensorShape shape, Format format, int fixed_point_position = 0); + + /** Create an uninitialised tensor of the given @p shape and @p data type. + * + * @param[in] shape Shape of the new raw tensor. + * @param[in] data_type Data type of the new raw tensor. + * @param[in] num_channels (Optional) Number of channels (default = 1). + * @param[in] fixed_point_position (Optional) Number of bits for the fractional part of the fixed point numbers (default = 0). + */ + RawTensor(TensorShape shape, DataType data_type, int num_channels = 1, int fixed_point_position = 0); + + /** Create a deep copy of the given @p tensor. + * + * @param[in] tensor To be copied tensor. + */ + RawTensor(const RawTensor &tensor); + + RawTensor &operator =(RawTensor tensor); + RawTensor(RawTensor &&) = default; + ~RawTensor() = default; + + /** Read only access to the specified element. + * + * @param[in] coord Coordinates of the desired element. + * + * @return A pointer to the desired element. + */ + const void *operator()(const Coordinates &coord) const override; + + /** Access to the specified element. + * + * @param[in] coord Coordinates of the desired element. + * + * @return A pointer to the desired element. + */ + void *operator()(const Coordinates &coord) override; +}; +} // namespace test +} // namespace arm_compute +#endif /* __ARM_COMPUTE_TEST_RAW_TENSOR_H__ */ diff --git a/tests/validation/Reference.cpp b/tests/validation_old/Reference.cpp index a621fea8a9..9099820929 100644 --- a/tests/validation/Reference.cpp +++ b/tests/validation_old/Reference.cpp @@ -23,11 +23,11 @@ */ #include "Reference.h" -#include "AssetsLibrary.h" -#include "Globals.h" #include "Helpers.h" #include "ReferenceCPP.h" -#include "validation/Helpers.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" +#include "tests/validation_old/Helpers.h" #include <random> #include <vector> diff --git a/tests/validation/Reference.h b/tests/validation_old/Reference.h index 698b60e96b..698b60e96b 100644 --- a/tests/validation/Reference.h +++ b/tests/validation_old/Reference.h diff --git a/tests/validation/ReferenceCPP.cpp b/tests/validation_old/ReferenceCPP.cpp index 029f6586f5..31c170a040 100644 --- a/tests/validation/ReferenceCPP.cpp +++ b/tests/validation_old/ReferenceCPP.cpp @@ -34,7 +34,7 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/runtime/Tensor.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <algorithm> #include <functional> diff --git a/tests/validation/ReferenceCPP.h b/tests/validation_old/ReferenceCPP.h index fcc4da471d..fcc4da471d 100644 --- a/tests/validation/ReferenceCPP.h +++ b/tests/validation_old/ReferenceCPP.h diff --git a/tests/validation_old/SConscript b/tests/validation_old/SConscript new file mode 100644 index 0000000000..fdf8e7fff8 --- /dev/null +++ b/tests/validation_old/SConscript @@ -0,0 +1,119 @@ +# Copyright (c) 2017 ARM Limited. +# +# SPDX-License-Identifier: MIT +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +import SCons +import os.path + +Import('env') +Import('vars') + +# vars is imported from arm_compute: +variables = [ + #FIXME: Remove before release! + BoolVariable("openvx", "Enable OpenVX support in tests", False), + BoolVariable("openblas", "Enable OpenBLAS support in tests", False), + #FIXME Remove before release (And remove all references to INTERNAL_ONLY) + BoolVariable("internal_only", "Enable ARM internal only tests", True), + BoolVariable("pmu", "Enable PMU counters", False), + BoolVariable("validation_tests", "Build validation test programs", True), + BoolVariable("benchmark_tests", "Build benchmark test programs", True) +] + +# We need a separate set of Variables for the Help message (Otherwise the global variables will get displayed twice) +new_options = Variables('scons') + +for v in variables: + new_options.Add(v) + vars.Add(v) + +# Clone the environment to make sure we're not polluting the arm_compute one: +old_validation_env = env.Clone() +vars.Update(old_validation_env) + +Help(new_options.GenerateHelpText(old_validation_env)) + +if old_validation_env['openblas']: + if env['os'] == 'bare_metal': + print("OpenBLAS is not supported on bare metal") + Exit(1) + old_validation_env.Append(CPPDEFINES = ['USE_OPENBLAS']) + old_validation_env.Append(LIBS = ['openblas', 'pthread']) + +if env['os'] in ['android', 'bare_metal'] or env['standalone']: + Import('arm_compute_a') + old_validation_env.Append(LIBS = [arm_compute_a]) + arm_compute_lib = arm_compute_a +else: + Import('arm_compute_so') + old_validation_env.Append(LIBS = ["arm_compute"]) + arm_compute_lib = arm_compute_so + +#FIXME Delete before release +if old_validation_env['internal_only']: + old_validation_env.Append(CPPDEFINES=['INTERNAL_ONLY']) + +old_validation_env.Append(CPPPATH = [".", "#tests", "#3rdparty/include"]) +old_validation_env.Append(LIBPATH = ["#3rdparty/%s/%s" % (env['os'], env['arch'])]) +old_validation_env.Append(LIBPATH = ["#build/%s" % env['build_dir']]) +old_validation_env.Append(LIBPATH = ["#build/%s/opencl-1.2-stubs" % env['build_dir']]) +old_validation_env.Append(LIBS = ['boost_program_options']) +old_validation_env.Append(CXXFLAGS = ['-Wno-missing-field-initializers']) +old_validation_env.Append(CPPDEFINES=['BOOST']) +old_validation_env.Append(LIBS = ['boost_unit_test_framework']) + +old_files_validation = Glob('*.cpp') + +# Add unit tests +old_files_validation += Glob('UNIT/*.cpp') +old_files_validation += Glob('UNIT/*/*.cpp') + +if env['opencl']: + Import('opencl') + + old_files_validation += Glob('CL/*.cpp') + old_files_validation += Glob('CL/*/*.cpp') + old_files_validation += Glob('system_tests/CL/*.cpp') + + old_validation_env.Append(LIBS = "OpenCL") + old_validation_env.Append(CPPDEFINES=['ARM_COMPUTE_CL']) + +#FIXME Remove before release +if old_validation_env['openvx']: + old_files_validation += Glob('VX/*.cpp') + old_files_validation += Glob('VX/*/*.cpp') + + old_validation_env.Append(LIBS = ['openvx', 'vxu']) + +if env['neon']: + old_files_validation += Glob('NEON/*.cpp') + old_files_validation += Glob('NEON/*/*.cpp') + old_files_validation += Glob('system_tests/NEON/*.cpp') + +if env['os'] == 'android': + old_validation_env.Append(LIBS = ["log"]) + +if old_validation_env['validation_tests']: + arm_compute_validation_old = old_validation_env.Program('arm_compute_validation_old', old_files_validation) + Depends(arm_compute_validation_old, arm_compute_lib) + if env['opencl']: + Depends(arm_compute_validation_old, opencl) + Default(arm_compute_validation_old) + Export('arm_compute_validation_old') diff --git a/tests/validation/Tensor.h b/tests/validation_old/Tensor.h index 84d76e7143..84d76e7143 100644 --- a/tests/validation/Tensor.h +++ b/tests/validation_old/Tensor.h diff --git a/tests/validation/TensorFactory.h b/tests/validation_old/TensorFactory.h index a3bb5f9615..3f5b960927 100644 --- a/tests/validation/TensorFactory.h +++ b/tests/validation_old/TensorFactory.h @@ -26,10 +26,10 @@ #include "arm_compute/core/Error.h" #include "tests/RawTensor.h" -#include "tests/validation/Tensor.h" -#include "tests/validation/half.h" +#include "tests/validation_old/Tensor.h" +#include "tests/validation_old/half.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" namespace arm_compute { diff --git a/tests/validation/TensorOperations.h b/tests/validation_old/TensorOperations.h index b9ffa49544..48661bbab9 100644 --- a/tests/validation/TensorOperations.h +++ b/tests/validation_old/TensorOperations.h @@ -30,10 +30,10 @@ #include "support/ToolchainSupport.h" #include "tests/Types.h" #include "tests/Utils.h" -#include "tests/validation/FixedPoint.h" -#include "tests/validation/Tensor.h" -#include "tests/validation/ValidationUserConfiguration.h" -#include "tests/validation/half.h" +#include "tests/validation_old/FixedPoint.h" +#include "tests/validation_old/Tensor.h" +#include "tests/validation_old/ValidationUserConfiguration.h" +#include "tests/validation_old/half.h" #include <algorithm> #include <array> diff --git a/tests/validation/TensorVisitors.h b/tests/validation_old/TensorVisitors.h index a15d2ad1dd..6e5f8c3b21 100644 --- a/tests/validation/TensorVisitors.h +++ b/tests/validation_old/TensorVisitors.h @@ -30,7 +30,7 @@ #include "arm_compute/core/Helpers.h" #include "arm_compute/runtime/Lut.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <algorithm> #include <map> diff --git a/tests/validation/UNIT/FixedPoint.cpp b/tests/validation_old/UNIT/FixedPoint.cpp index 00cab9eb29..53fef97769 100644 --- a/tests/validation/UNIT/FixedPoint.cpp +++ b/tests/validation_old/UNIT/FixedPoint.cpp @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "validation/FixedPoint.h" +#include "tests/validation_old/FixedPoint.h" #include "TypePrinter.h" #include "Utils.h" #include "support/ToolchainSupport.h" -#include "validation/Validation.h" -#include "validation/ValidationUserConfiguration.h" +#include "tests/validation_old/Validation.h" +#include "tests/validation_old/ValidationUserConfiguration.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <fstream> #include <vector> diff --git a/tests/validation/UNIT/TensorInfo.cpp b/tests/validation_old/UNIT/TensorInfo.cpp index c74cfebfe4..f2a3acfee0 100644 --- a/tests/validation/UNIT/TensorInfo.cpp +++ b/tests/validation_old/UNIT/TensorInfo.cpp @@ -22,12 +22,12 @@ * SOFTWARE. */ #include "TypePrinter.h" -#include "validation/Validation.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/TensorInfo.h" #include "arm_compute/core/Types.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" using namespace arm_compute; using namespace arm_compute::test; diff --git a/tests/validation/UNIT/TensorShape.cpp b/tests/validation_old/UNIT/TensorShape.cpp index 4c1ef680b5..dc75b93de4 100644 --- a/tests/validation/UNIT/TensorShape.cpp +++ b/tests/validation_old/UNIT/TensorShape.cpp @@ -22,11 +22,11 @@ * SOFTWARE. */ #include "TypePrinter.h" -#include "validation/Validation.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/core/TensorShape.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" using namespace arm_compute; using namespace arm_compute::test; diff --git a/tests/validation/UNIT/Utils.cpp b/tests/validation_old/UNIT/Utils.cpp index e28ca19620..b302bf27c1 100644 --- a/tests/validation/UNIT/Utils.cpp +++ b/tests/validation_old/UNIT/Utils.cpp @@ -24,9 +24,9 @@ #include "Utils.h" #include "TypePrinter.h" -#include "validation/Validation.h" +#include "tests/validation_old/Validation.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <stdexcept> diff --git a/tests/UserConfiguration.cpp b/tests/validation_old/UserConfiguration.cpp index a24de90468..a24de90468 100644 --- a/tests/UserConfiguration.cpp +++ b/tests/validation_old/UserConfiguration.cpp diff --git a/tests/UserConfiguration.h b/tests/validation_old/UserConfiguration.h index 815da04810..815da04810 100644 --- a/tests/UserConfiguration.h +++ b/tests/validation_old/UserConfiguration.h diff --git a/tests/validation_old/Validation.cpp b/tests/validation_old/Validation.cpp new file mode 100644 index 0000000000..8f173ba962 --- /dev/null +++ b/tests/validation_old/Validation.cpp @@ -0,0 +1,477 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "Validation.h" + +#include "arm_compute/core/Coordinates.h" +#include "arm_compute/core/Error.h" +#include "arm_compute/core/FixedPoint.h" +#include "arm_compute/core/IArray.h" +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/runtime/Tensor.h" +#include "tests/IAccessor.h" +#include "tests/RawTensor.h" +#include "tests/TypePrinter.h" +#include "tests/Utils.h" +#include "tests/validation_old/half.h" + +#include <array> +#include <cmath> +#include <cstddef> +#include <cstdint> +#include <iomanip> +#include <vector> + +namespace arm_compute +{ +namespace test +{ +namespace validation +{ +namespace +{ +/** Get the data from *ptr after casting according to @p data_type and then convert the data to double. + * + * @param[in] ptr Pointer to value. + * @param[in] data_type Data type of both values. + * + * @return The data from the ptr after converted to double. + */ +double get_double_data(const void *ptr, DataType data_type) +{ + if(ptr == nullptr) + { + ARM_COMPUTE_ERROR("Can't dereference a null pointer!"); + } + + switch(data_type) + { + case DataType::U8: + return *reinterpret_cast<const uint8_t *>(ptr); + case DataType::S8: + return *reinterpret_cast<const int8_t *>(ptr); + case DataType::QS8: + return *reinterpret_cast<const qint8_t *>(ptr); + case DataType::U16: + return *reinterpret_cast<const uint16_t *>(ptr); + case DataType::S16: + return *reinterpret_cast<const int16_t *>(ptr); + case DataType::QS16: + return *reinterpret_cast<const qint16_t *>(ptr); + case DataType::U32: + return *reinterpret_cast<const uint32_t *>(ptr); + case DataType::S32: + return *reinterpret_cast<const int32_t *>(ptr); + case DataType::U64: + return *reinterpret_cast<const uint64_t *>(ptr); + case DataType::S64: + return *reinterpret_cast<const int64_t *>(ptr); + case DataType::F16: + return *reinterpret_cast<const half_float::half *>(ptr); + case DataType::F32: + return *reinterpret_cast<const float *>(ptr); + case DataType::F64: + return *reinterpret_cast<const double *>(ptr); + case DataType::SIZET: + return *reinterpret_cast<const size_t *>(ptr); + default: + ARM_COMPUTE_ERROR("NOT SUPPORTED!"); + } +} + +bool is_equal(double target, double ref, double max_absolute_error = std::numeric_limits<double>::epsilon(), double max_relative_error = 0.0001f) +{ + if(!std::isfinite(target) || !std::isfinite(ref)) + { + return false; + } + + // No need further check if they are equal + if(ref == target) + { + return true; + } + + // Need this check for the situation when the two values close to zero but have different sign + if(std::abs(std::abs(ref) - std::abs(target)) <= max_absolute_error) + { + return true; + } + + double relative_error = 0; + + if(std::abs(target) > std::abs(ref)) + { + relative_error = std::abs((target - ref) / target); + } + else + { + relative_error = std::abs((ref - target) / ref); + } + + return relative_error <= max_relative_error; +} + +void check_border_element(const IAccessor &tensor, const Coordinates &id, + const BorderMode &border_mode, const void *border_value, + int64_t &num_elements, int64_t &num_mismatches) +{ + const size_t channel_size = element_size_from_data_type(tensor.data_type()); + const auto ptr = static_cast<const uint8_t *>(tensor(id)); + + if(border_mode == BorderMode::REPLICATE) + { + Coordinates border_id{ id }; + border_id.set(1, 0); + border_value = tensor(border_id); + } + + // Iterate over all channels within one element + for(int channel = 0; channel < tensor.num_channels(); ++channel) + { + const size_t channel_offset = channel * channel_size; + const double target = get_double_data(ptr + channel_offset, tensor.data_type()); + const double ref = get_double_data(static_cast<const uint8_t *>(border_value) + channel_offset, tensor.data_type()); + const bool equal = is_equal(target, ref); + + BOOST_TEST_INFO("id = " << id); + BOOST_TEST_INFO("channel = " << channel); + BOOST_TEST_INFO("reference = " << std::setprecision(5) << ref); + BOOST_TEST_INFO("target = " << std::setprecision(5) << target); + BOOST_TEST_WARN(equal); + + if(!equal) + { + ++num_mismatches; + } + + ++num_elements; + } +} + +void check_single_element(const Coordinates &id, const IAccessor &tensor, const RawTensor &reference, float tolerance_value, + uint64_t wrap_range, int min_channels, size_t channel_size, int64_t &num_mismatches, int64_t &num_elements) +{ + const auto ptr = static_cast<const uint8_t *>(tensor(id)); + const auto ref_ptr = static_cast<const uint8_t *>(reference(id)); + + // Iterate over all channels within one element + for(int channel = 0; channel < min_channels; ++channel) + { + const size_t channel_offset = channel * channel_size; + const double target = get_double_data(ptr + channel_offset, reference.data_type()); + const double ref = get_double_data(ref_ptr + channel_offset, reference.data_type()); + bool equal = is_equal(target, ref, tolerance_value); + + if(wrap_range != 0 && !equal) + { + equal = is_equal(target, ref, wrap_range - tolerance_value); + } + + if(!equal) + { + BOOST_TEST_INFO("id = " << id); + BOOST_TEST_INFO("channel = " << channel); + BOOST_TEST_INFO("reference = " << std::setprecision(5) << ref); + BOOST_TEST_INFO("target = " << std::setprecision(5) << target); + BOOST_TEST_WARN(equal); + ++num_mismatches; + } + ++num_elements; + } +} +} // namespace + +void validate(const arm_compute::ValidRegion ®ion, const arm_compute::ValidRegion &reference) +{ + BOOST_TEST(region.anchor.num_dimensions() == reference.anchor.num_dimensions()); + BOOST_TEST(region.shape.num_dimensions() == reference.shape.num_dimensions()); + + for(unsigned int d = 0; d < region.anchor.num_dimensions(); ++d) + { + BOOST_TEST(region.anchor[d] == reference.anchor[d]); + } + + for(unsigned int d = 0; d < region.shape.num_dimensions(); ++d) + { + BOOST_TEST(region.shape[d] == reference.shape[d]); + } +} + +void validate(const arm_compute::PaddingSize &padding, const arm_compute::PaddingSize &reference) +{ + BOOST_TEST(padding.top == reference.top); + BOOST_TEST(padding.right == reference.right); + BOOST_TEST(padding.bottom == reference.bottom); + BOOST_TEST(padding.left == reference.left); +} + +void validate(const IAccessor &tensor, const RawTensor &reference, float tolerance_value, float tolerance_number, uint64_t wrap_range) +{ + // Validate with valid region covering the entire shape + validate(tensor, reference, shape_to_valid_region(tensor.shape()), tolerance_value, tolerance_number, wrap_range); +} + +void validate(const IAccessor &tensor, const RawTensor &reference, const ValidRegion &valid_region, float tolerance_value, float tolerance_number, uint64_t wrap_range) +{ + int64_t num_mismatches = 0; + int64_t num_elements = 0; + + BOOST_TEST(tensor.element_size() == reference.element_size()); + BOOST_TEST(tensor.format() == reference.format()); + BOOST_TEST(tensor.data_type() == reference.data_type()); + BOOST_TEST(tensor.num_channels() == reference.num_channels()); + BOOST_TEST(compare_dimensions(tensor.shape(), reference.shape())); + + const int min_elements = std::min(tensor.num_elements(), reference.num_elements()); + const int min_channels = std::min(tensor.num_channels(), reference.num_channels()); + const size_t channel_size = element_size_from_data_type(reference.data_type()); + + // Iterate over all elements within valid region, e.g. U8, S16, RGB888, ... + for(int element_idx = 0; element_idx < min_elements; ++element_idx) + { + const Coordinates id = index2coord(reference.shape(), element_idx); + if(is_in_valid_region(valid_region, id)) + { + check_single_element(id, tensor, reference, tolerance_value, wrap_range, min_channels, channel_size, num_mismatches, num_elements); + } + } + + const int64_t absolute_tolerance_number = tolerance_number * num_elements; + const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f; + + BOOST_TEST(num_mismatches <= absolute_tolerance_number, + num_mismatches << " values (" << std::setprecision(2) << percent_mismatches + << "%) mismatched (maximum tolerated " << std::setprecision(2) << tolerance_number << "%)"); +} + +void validate(const IAccessor &tensor, const RawTensor &reference, const RawTensor &valid_mask, float tolerance_value, float tolerance_number, uint64_t wrap_range) +{ + int64_t num_mismatches = 0; + int64_t num_elements = 0; + + BOOST_TEST(tensor.element_size() == reference.element_size()); + BOOST_TEST(tensor.format() == reference.format()); + BOOST_TEST(tensor.data_type() == reference.data_type()); + BOOST_TEST(tensor.num_channels() == reference.num_channels()); + BOOST_TEST(compare_dimensions(tensor.shape(), reference.shape())); + + const int min_elements = std::min(tensor.num_elements(), reference.num_elements()); + const int min_channels = std::min(tensor.num_channels(), reference.num_channels()); + const size_t channel_size = element_size_from_data_type(reference.data_type()); + + // Iterate over all elements within valid region, e.g. U8, S16, RGB888, ... + for(int element_idx = 0; element_idx < min_elements; ++element_idx) + { + const Coordinates id = index2coord(reference.shape(), element_idx); + if(valid_mask[element_idx] == 1) + { + check_single_element(id, tensor, reference, tolerance_value, wrap_range, min_channels, channel_size, num_mismatches, num_elements); + } + else + { + ++num_elements; + } + } + + const int64_t absolute_tolerance_number = tolerance_number * num_elements; + const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f; + + BOOST_TEST(num_mismatches <= absolute_tolerance_number, + num_mismatches << " values (" << std::setprecision(2) << percent_mismatches + << "%) mismatched (maximum tolerated " << std::setprecision(2) << tolerance_number << "%)"); +} + +void validate(const IAccessor &tensor, const void *reference_value) +{ + BOOST_TEST_REQUIRE((reference_value != nullptr)); + + int64_t num_mismatches = 0; + int64_t num_elements = 0; + const size_t channel_size = element_size_from_data_type(tensor.data_type()); + + // Iterate over all elements, e.g. U8, S16, RGB888, ... + for(int element_idx = 0; element_idx < tensor.num_elements(); ++element_idx) + { + const Coordinates id = index2coord(tensor.shape(), element_idx); + + const auto ptr = static_cast<const uint8_t *>(tensor(id)); + + // Iterate over all channels within one element + for(int channel = 0; channel < tensor.num_channels(); ++channel) + { + const size_t channel_offset = channel * channel_size; + const double target = get_double_data(ptr + channel_offset, tensor.data_type()); + const double ref = get_double_data(reference_value, tensor.data_type()); + const bool equal = is_equal(target, ref); + + BOOST_TEST_INFO("id = " << id); + BOOST_TEST_INFO("channel = " << channel); + BOOST_TEST_INFO("reference = " << std::setprecision(5) << ref); + BOOST_TEST_INFO("target = " << std::setprecision(5) << target); + BOOST_TEST_WARN(equal); + + if(!equal) + { + ++num_mismatches; + } + + ++num_elements; + } + } + + const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f; + + BOOST_TEST(num_mismatches == 0, + num_mismatches << " values (" << std::setprecision(2) << percent_mismatches << "%) mismatched"); +} + +void validate(const IAccessor &tensor, BorderSize border_size, const BorderMode &border_mode, const void *border_value) +{ + if(border_mode == BorderMode::UNDEFINED) + { + return; + } + else if(border_mode == BorderMode::CONSTANT) + { + BOOST_TEST((border_value != nullptr)); + } + + int64_t num_mismatches = 0; + int64_t num_elements = 0; + const int slice_size = tensor.shape()[0] * tensor.shape()[1]; + + for(int element_idx = 0; element_idx < tensor.num_elements(); element_idx += slice_size) + { + Coordinates id = index2coord(tensor.shape(), element_idx); + + // Top border + for(int y = -border_size.top; y < 0; ++y) + { + id.set(1, y); + + for(int x = -border_size.left; x < static_cast<int>(tensor.shape()[0]) + static_cast<int>(border_size.right); ++x) + { + id.set(0, x); + + check_border_element(tensor, id, border_mode, border_value, num_elements, num_mismatches); + } + } + + // Bottom border + for(int y = tensor.shape()[1]; y < static_cast<int>(tensor.shape()[1]) + static_cast<int>(border_size.bottom); ++y) + { + id.set(1, y); + + for(int x = -border_size.left; x < static_cast<int>(tensor.shape()[0]) + static_cast<int>(border_size.right); ++x) + { + id.set(0, x); + + check_border_element(tensor, id, border_mode, border_value, num_elements, num_mismatches); + } + } + + // Left/right border + for(int y = 0; y < static_cast<int>(tensor.shape()[1]); ++y) + { + id.set(1, y); + + // Left border + for(int x = -border_size.left; x < 0; ++x) + { + id.set(0, x); + + check_border_element(tensor, id, border_mode, border_value, num_elements, num_mismatches); + } + + // Right border + for(int x = tensor.shape()[0]; x < static_cast<int>(tensor.shape()[0]) + static_cast<int>(border_size.right); ++x) + { + id.set(0, x); + + check_border_element(tensor, id, border_mode, border_value, num_elements, num_mismatches); + } + } + } + + const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f; + + BOOST_TEST(num_mismatches == 0, + num_mismatches << " values (" << std::setprecision(2) << percent_mismatches << "%) mismatched"); +} + +void validate(std::vector<unsigned int> classified_labels, std::vector<unsigned int> expected_labels) +{ + ARM_COMPUTE_UNUSED(classified_labels); + ARM_COMPUTE_UNUSED(expected_labels); + BOOST_TEST(expected_labels.size() != 0); + BOOST_TEST(classified_labels.size() == expected_labels.size()); + + for(unsigned int i = 0; i < expected_labels.size(); ++i) + { + BOOST_TEST(classified_labels[i] == expected_labels[i]); + } +} + +void validate(float target, float ref, float tolerance_abs_error, float tolerance_relative_error) +{ + const bool equal = is_equal(target, ref, tolerance_abs_error, tolerance_relative_error); + + BOOST_TEST_INFO("reference = " << std::setprecision(5) << ref); + BOOST_TEST_INFO("target = " << std::setprecision(5) << target); + BOOST_TEST(equal); +} + +void validate(IArray<KeyPoint> &target, IArray<KeyPoint> &ref, int64_t tolerance) +{ + int64_t num_mismatches = 0; + + BOOST_TEST_WARN(target.num_values() == ref.num_values()); + + for(size_t i = 0; i < target.num_values(); ++i) + { + KeyPoint *ref_val = std::find_if(ref.buffer(), ref.buffer() + ref.num_values(), [&target, i](KeyPoint key) + { + return key.x == target.at(i).x && key.y == target.at(i).y; + }); + + const KeyPoint &key = target.at(i); + + if((ref_val == ref.buffer() + ref.num_values()) || !(is_equal(key.strength, ref_val->strength) && is_equal(key.scale, ref_val->scale) && is_equal(key.orientation, ref_val->orientation) + && is_equal(key.tracking_status, ref_val->tracking_status) && is_equal(key.error, ref_val->error))) + { + ++num_mismatches; + + BOOST_TEST_WARN(is_equal(key.strength, ref_val->strength)); + BOOST_TEST_WARN(is_equal(key.scale, ref_val->scale)); + BOOST_TEST_WARN(is_equal(key.orientation, ref_val->orientation)); + BOOST_TEST_WARN(is_equal(key.tracking_status, ref_val->tracking_status)); + BOOST_TEST_WARN(is_equal(key.error, ref_val->error)); + } + } + + BOOST_TEST(num_mismatches <= tolerance); +} +} // namespace validation +} // namespace test +} // namespace arm_compute diff --git a/tests/validation_old/Validation.h b/tests/validation_old/Validation.h new file mode 100644 index 0000000000..4c8752b937 --- /dev/null +++ b/tests/validation_old/Validation.h @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef __ARM_COMPUTE_TEST_REFERENCE_VALIDATION_H__ +#define __ARM_COMPUTE_TEST_REFERENCE_VALIDATION_H__ + +#include "arm_compute/core/Types.h" +#include "arm_compute/runtime/Array.h" +#include "tests/RawTensor.h" + +#include "tests/validation_old/boost_wrapper.h" + +#include <vector> + +namespace arm_compute +{ +class Tensor; + +namespace test +{ +class IAccessor; + +namespace validation +{ +template <typename T> +boost::test_tools::predicate_result compare_dimensions(const Dimensions<T> &dimensions1, const Dimensions<T> &dimensions2) +{ + if(dimensions1.num_dimensions() != dimensions2.num_dimensions()) + { + boost::test_tools::predicate_result result(false); + result.message() << "Different dimensionality [" << dimensions1.num_dimensions() << "!=" << dimensions2.num_dimensions() << "]"; + return result; + } + + for(unsigned int i = 0; i < dimensions1.num_dimensions(); ++i) + { + if(dimensions1[i] != dimensions2[i]) + { + boost::test_tools::predicate_result result(false); + result.message() << "Mismatch in dimension " << i << " [" << dimensions1[i] << "!=" << dimensions2[i] << "]"; + return result; + } + } + + return true; +} + +/** Validate valid regions. + * + * - Dimensionality has to be the same. + * - Anchors have to match. + * - Shapes have to match. + */ +void validate(const arm_compute::ValidRegion ®ion, const arm_compute::ValidRegion &reference); + +/** Validate padding. + * + * Padding on all sides has to be the same. + */ +void validate(const arm_compute::PaddingSize &padding, const arm_compute::PaddingSize &reference); + +/** Validate tensors. + * + * - Dimensionality has to be the same. + * - All values have to match. + * + * @note: wrap_range allows cases where reference tensor rounds up to the wrapping point, causing it to wrap around to + * zero while the test tensor stays at wrapping point to pass. This may permit true erroneous cases (difference between + * reference tensor and test tensor is multiple of wrap_range), but such errors would be detected by + * other test cases. + */ +void validate(const IAccessor &tensor, const RawTensor &reference, float tolerance_value = 0.f, float tolerance_number = 0.f, uint64_t wrap_range = 0); + +/** Validate tensors with valid region. + * + * - Dimensionality has to be the same. + * - All values have to match. + * + * @note: wrap_range allows cases where reference tensor rounds up to the wrapping point, causing it to wrap around to + * zero while the test tensor stays at wrapping point to pass. This may permit true erroneous cases (difference between + * reference tensor and test tensor is multiple of wrap_range), but such errors would be detected by + * other test cases. + */ +void validate(const IAccessor &tensor, const RawTensor &reference, const ValidRegion &valid_region, float tolerance_value = 0.f, float tolerance_number = 0.f, uint64_t wrap_range = 0); + +/** Validate tensors with valid mask. + * + * - Dimensionality has to be the same. + * - All values have to match. + * + * @note: wrap_range allows cases where reference tensor rounds up to the wrapping point, causing it to wrap around to + * zero while the test tensor stays at wrapping point to pass. This may permit true erroneous cases (difference between + * reference tensor and test tensor is multiple of wrap_range), but such errors would be detected by + * other test cases. + */ +void validate(const IAccessor &tensor, const RawTensor &reference, const RawTensor &valid_mask, float tolerance_value = 0.f, float tolerance_number = 0.f, uint64_t wrap_range = 0); + +/** Validate tensors against constant value. + * + * - All values have to match. + */ +void validate(const IAccessor &tensor, const void *reference_value); + +/** Validate border against a constant value. + * + * - All border values have to match the specified value if mode is CONSTANT. + * - All border values have to be replicated if mode is REPLICATE. + * - Nothing is validated for mode UNDEFINED. + */ +void validate(const IAccessor &tensor, BorderSize border_size, const BorderMode &border_mode, const void *border_value); + +/** Validate classified labels against expected ones. + * + * - All values should match + */ +void validate(std::vector<unsigned int> classified_labels, std::vector<unsigned int> expected_labels); + +/** Validate float value. + * + * - All values should match + */ +void validate(float target, float ref, float tolerance_abs_error = std::numeric_limits<float>::epsilon(), float tolerance_relative_error = 0.0001f); + +/** Validate min max location. + * + * - All values should match + */ +template <typename T> +void validate_min_max_loc(T min, T ref_min, T max, T ref_max, + IArray<Coordinates2D> &min_loc, IArray<Coordinates2D> &ref_min_loc, IArray<Coordinates2D> &max_loc, IArray<Coordinates2D> &ref_max_loc, + uint32_t min_count, uint32_t ref_min_count, uint32_t max_count, uint32_t ref_max_count) +{ + BOOST_TEST(min == ref_min); + BOOST_TEST(max == ref_max); + + BOOST_TEST(min_count == min_loc.num_values()); + BOOST_TEST(max_count == max_loc.num_values()); + BOOST_TEST(ref_min_count == ref_min_loc.num_values()); + BOOST_TEST(ref_max_count == ref_max_loc.num_values()); + + BOOST_TEST(min_count == ref_min_count); + BOOST_TEST(max_count == ref_max_count); + + for(uint32_t i = 0; i < min_count; i++) + { + Coordinates2D *same_coords = std::find_if(ref_min_loc.buffer(), ref_min_loc.buffer() + min_count, [&min_loc, i](Coordinates2D coord) + { + return coord.x == min_loc.at(i).x && coord.y == min_loc.at(i).y; + }); + + BOOST_TEST(same_coords != ref_min_loc.buffer() + min_count); + } + + for(uint32_t i = 0; i < max_count; i++) + { + Coordinates2D *same_coords = std::find_if(ref_max_loc.buffer(), ref_max_loc.buffer() + max_count, [&max_loc, i](Coordinates2D coord) + { + return coord.x == max_loc.at(i).x && coord.y == max_loc.at(i).y; + }); + + BOOST_TEST(same_coords != ref_max_loc.buffer() + max_count); + } +} + +/** Validate KeyPoint arrays. + * + * - All values should match + */ +void validate(IArray<KeyPoint> &target, IArray<KeyPoint> &ref, int64_t tolerance = 0); +} // namespace validation +} // namespace test +} // namespace arm_compute +#endif /* __ARM_COMPUTE_TEST_REFERENCE_VALIDATION_H__ */ diff --git a/tests/validation/ValidationProgramOptions.cpp b/tests/validation_old/ValidationProgramOptions.cpp index adb8c5ab6c..adb8c5ab6c 100644 --- a/tests/validation/ValidationProgramOptions.cpp +++ b/tests/validation_old/ValidationProgramOptions.cpp diff --git a/tests/validation/ValidationProgramOptions.h b/tests/validation_old/ValidationProgramOptions.h index 6b29b807de..6b29b807de 100644 --- a/tests/validation/ValidationProgramOptions.h +++ b/tests/validation_old/ValidationProgramOptions.h diff --git a/tests/validation/ValidationUserConfiguration.h b/tests/validation_old/ValidationUserConfiguration.h index a9b8b4fe40..a9b8b4fe40 100644 --- a/tests/validation/ValidationUserConfiguration.h +++ b/tests/validation_old/ValidationUserConfiguration.h diff --git a/tests/boost_wrapper.h b/tests/validation_old/boost_wrapper.h index b584e4cd1f..b584e4cd1f 100644 --- a/tests/boost_wrapper.h +++ b/tests/validation_old/boost_wrapper.h diff --git a/tests/dataset/ActivationFunctionDataset.h b/tests/validation_old/dataset/ActivationFunctionDataset.h index e6c196560b..b72cffbcd9 100644 --- a/tests/dataset/ActivationFunctionDataset.h +++ b/tests/validation_old/dataset/ActivationFunctionDataset.h @@ -25,10 +25,10 @@ #define __ARM_COMPUTE_TEST_DATASET_ACTIVATION_FUNCTION_DATASET_H__ #include "arm_compute/core/Types.h" -#include "dataset/GenericDataset.h" +#include "tests/validation_old/dataset/GenericDataset.h" #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/dataset/ActivationLayerDataset.h b/tests/validation_old/dataset/ActivationLayerDataset.h index ef6f382f97..ead52a2961 100644 --- a/tests/dataset/ActivationLayerDataset.h +++ b/tests/validation_old/dataset/ActivationLayerDataset.h @@ -28,13 +28,13 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "dataset/GenericDataset.h" +#include "tests/validation_old/dataset/GenericDataset.h" #include <sstream> #include <type_traits> #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/dataset/BatchNormalizationLayerDataset.h b/tests/validation_old/dataset/BatchNormalizationLayerDataset.h index f1ba212b97..ca1e3b694c 100644 --- a/tests/dataset/BatchNormalizationLayerDataset.h +++ b/tests/validation_old/dataset/BatchNormalizationLayerDataset.h @@ -28,13 +28,13 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "dataset/GenericDataset.h" +#include "tests/validation_old/dataset/GenericDataset.h" #include <ostream> #include <sstream> #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/dataset/BorderModeDataset.h b/tests/validation_old/dataset/BorderModeDataset.h index debf7bdf00..d1eb48d3bd 100644 --- a/tests/dataset/BorderModeDataset.h +++ b/tests/validation_old/dataset/BorderModeDataset.h @@ -27,7 +27,7 @@ #include "arm_compute/core/Types.h" #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ #include <array> diff --git a/tests/dataset/ConvertPolicyDataset.h b/tests/validation_old/dataset/ConvertPolicyDataset.h index bca033e515..591b7ad388 100644 --- a/tests/dataset/ConvertPolicyDataset.h +++ b/tests/validation_old/dataset/ConvertPolicyDataset.h @@ -29,7 +29,7 @@ #include <type_traits> #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/dataset/ConvolutionLayerDataset.h b/tests/validation_old/dataset/ConvolutionLayerDataset.h index 3d8ec4a2d9..4fcba8d86d 100644 --- a/tests/dataset/ConvolutionLayerDataset.h +++ b/tests/validation_old/dataset/ConvolutionLayerDataset.h @@ -27,14 +27,14 @@ #include "TypePrinter.h" #include "arm_compute/core/TensorShape.h" -#include "dataset/GenericDataset.h" -#include "dataset/ShapeDatasets.h" +#include "tests/validation_old/dataset/GenericDataset.h" +#include "tests/validation_old/dataset/ShapeDatasets.h" #include <sstream> #include <type_traits> #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/dataset/DataTypeDatasets.h b/tests/validation_old/dataset/DataTypeDatasets.h index 5f313711c0..34fc782b10 100644 --- a/tests/dataset/DataTypeDatasets.h +++ b/tests/validation_old/dataset/DataTypeDatasets.h @@ -27,7 +27,7 @@ #include "arm_compute/core/Types.h" #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/dataset/FullyConnectedLayerDataset.h b/tests/validation_old/dataset/FullyConnectedLayerDataset.h index cf43a6302a..3564560788 100644 --- a/tests/dataset/FullyConnectedLayerDataset.h +++ b/tests/validation_old/dataset/FullyConnectedLayerDataset.h @@ -27,13 +27,13 @@ #include "TypePrinter.h" #include "arm_compute/core/TensorShape.h" -#include "dataset/GenericDataset.h" +#include "tests/validation_old/dataset/GenericDataset.h" #include <sstream> #include <type_traits> #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/dataset/GEMMDataset.h b/tests/validation_old/dataset/GEMMDataset.h index ce05557231..5250827340 100644 --- a/tests/dataset/GEMMDataset.h +++ b/tests/validation_old/dataset/GEMMDataset.h @@ -28,7 +28,7 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "dataset/GenericDataset.h" +#include "tests/validation_old/dataset/GenericDataset.h" #include <ostream> #include <sstream> @@ -37,7 +37,7 @@ #include <type_traits> #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/dataset/GenericDataset.h b/tests/validation_old/dataset/GenericDataset.h index 48754fccf8..d2c9f2db34 100644 --- a/tests/dataset/GenericDataset.h +++ b/tests/validation_old/dataset/GenericDataset.h @@ -30,7 +30,7 @@ #include <type_traits> #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/dataset/ImageDatasets.h b/tests/validation_old/dataset/ImageDatasets.h index 6aa25cf942..7fcd067e1b 100644 --- a/tests/dataset/ImageDatasets.h +++ b/tests/validation_old/dataset/ImageDatasets.h @@ -28,7 +28,7 @@ #include <type_traits> #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/dataset/InterpolationPolicyDataset.h b/tests/validation_old/dataset/InterpolationPolicyDataset.h index 0f3184c81a..64cc9bf239 100644 --- a/tests/dataset/InterpolationPolicyDataset.h +++ b/tests/validation_old/dataset/InterpolationPolicyDataset.h @@ -27,7 +27,7 @@ #include "arm_compute/core/Types.h" #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/dataset/MatrixPatternDataset.h b/tests/validation_old/dataset/MatrixPatternDataset.h index 050c4d9cfd..7d7d365d91 100644 --- a/tests/dataset/MatrixPatternDataset.h +++ b/tests/validation_old/dataset/MatrixPatternDataset.h @@ -27,7 +27,7 @@ #include "arm_compute/core/Types.h" #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ #include <array> diff --git a/tests/dataset/NonLinearFilterFunctionDataset.h b/tests/validation_old/dataset/NonLinearFilterFunctionDataset.h index a2db3239c3..c961c84866 100644 --- a/tests/dataset/NonLinearFilterFunctionDataset.h +++ b/tests/validation_old/dataset/NonLinearFilterFunctionDataset.h @@ -27,7 +27,7 @@ #include "arm_compute/core/Types.h" #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ #include <array> diff --git a/tests/dataset/NormalizationLayerDataset.h b/tests/validation_old/dataset/NormalizationLayerDataset.h index fc56694dc8..cd3c14d948 100644 --- a/tests/dataset/NormalizationLayerDataset.h +++ b/tests/validation_old/dataset/NormalizationLayerDataset.h @@ -28,13 +28,13 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "dataset/GenericDataset.h" +#include "tests/validation_old/dataset/GenericDataset.h" #include <sstream> #include <type_traits> #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/dataset/NormalizationTypeDataset.h b/tests/validation_old/dataset/NormalizationTypeDataset.h index 756772ee8f..2a89dbea30 100644 --- a/tests/dataset/NormalizationTypeDataset.h +++ b/tests/validation_old/dataset/NormalizationTypeDataset.h @@ -27,7 +27,7 @@ #include "arm_compute/core/Types.h" #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/dataset/PoolingLayerDataset.h b/tests/validation_old/dataset/PoolingLayerDataset.h index ee3e6dc4aa..6895ae4fae 100644 --- a/tests/dataset/PoolingLayerDataset.h +++ b/tests/validation_old/dataset/PoolingLayerDataset.h @@ -28,12 +28,12 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "dataset/GenericDataset.h" +#include "tests/validation_old/dataset/GenericDataset.h" #include <type_traits> #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/dataset/PoolingTypesDataset.h b/tests/validation_old/dataset/PoolingTypesDataset.h index c8e34665f4..a826df35ce 100644 --- a/tests/dataset/PoolingTypesDataset.h +++ b/tests/validation_old/dataset/PoolingTypesDataset.h @@ -25,10 +25,10 @@ #define __ARM_COMPUTE_TEST_DATASET_POOLING_TYPE_DATASET_H__ #include "arm_compute/core/Types.h" -#include "dataset/GenericDataset.h" +#include "tests/validation_old/dataset/GenericDataset.h" #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/dataset/RoundingPolicyDataset.h b/tests/validation_old/dataset/RoundingPolicyDataset.h index 0e7c7ba0c5..af946b41bd 100644 --- a/tests/dataset/RoundingPolicyDataset.h +++ b/tests/validation_old/dataset/RoundingPolicyDataset.h @@ -29,7 +29,7 @@ #include <type_traits> #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/dataset/ShapeDatasets.h b/tests/validation_old/dataset/ShapeDatasets.h index ccdfc9a7dd..3c986ab7ae 100644 --- a/tests/dataset/ShapeDatasets.h +++ b/tests/validation_old/dataset/ShapeDatasets.h @@ -29,7 +29,7 @@ #include <type_traits> #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/dataset/ThresholdDataset.h b/tests/validation_old/dataset/ThresholdDataset.h index e5a1e375ff..74d0b9cfbe 100644 --- a/tests/dataset/ThresholdDataset.h +++ b/tests/validation_old/dataset/ThresholdDataset.h @@ -28,7 +28,7 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "dataset/GenericDataset.h" +#include "tests/validation_old/dataset/GenericDataset.h" #include <ostream> #include <sstream> @@ -37,7 +37,7 @@ #include <type_traits> #ifdef BOOST -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #endif /* BOOST */ namespace arm_compute diff --git a/tests/validation_new/half.h b/tests/validation_old/half.h index 0ca620cf57..d8aa341068 100644 --- a/tests/validation_new/half.h +++ b/tests/validation_old/half.h @@ -34,5 +34,4 @@ #define HALF_ROUND_TIES_TO_EVEN 1 #include "half/half.hpp" - #endif /* __ARM_COMPUTE_TEST_HALF_H__ */ diff --git a/tests/validation/main.cpp b/tests/validation_old/main.cpp index a6c02ed4dd..9f15c3a7bc 100644 --- a/tests/validation/main.cpp +++ b/tests/validation_old/main.cpp @@ -23,16 +23,16 @@ */ #define BOOST_TEST_ALTERNATIVE_INIT_API -#include "AssetsLibrary.h" -#include "Globals.h" #include "Utils.h" #include "ValidationProgramOptions.h" #include "ValidationUserConfiguration.h" #include "support/ToolchainSupport.h" +#include "tests/AssetsLibrary.h" +#include "tests/Globals.h" #include "arm_compute/runtime/Scheduler.h" -#include "boost_wrapper.h" +#include "tests/validation_old/boost_wrapper.h" #include <iostream> #include <memory> diff --git a/tests/model_objects/AlexNet.h b/tests/validation_old/model_objects/AlexNet.h index 45622e2118..45622e2118 100644 --- a/tests/model_objects/AlexNet.h +++ b/tests/validation_old/model_objects/AlexNet.h diff --git a/tests/model_objects/LeNet5.h b/tests/validation_old/model_objects/LeNet5.h index d3e72b0010..d3e72b0010 100644 --- a/tests/model_objects/LeNet5.h +++ b/tests/validation_old/model_objects/LeNet5.h diff --git a/tests/validation/system_tests/CL/AlexNet.cpp b/tests/validation_old/system_tests/CL/AlexNet.cpp index 2b1d31f65f..b403b6e93c 100644 --- a/tests/validation/system_tests/CL/AlexNet.cpp +++ b/tests/validation_old/system_tests/CL/AlexNet.cpp @@ -46,7 +46,7 @@ * SOFTWARE. */ #include "CL/CLAccessor.h" -#include "validation/Validation.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/runtime/CL/CLSubTensor.h" #include "arm_compute/runtime/CL/functions/CLActivationLayer.h" @@ -56,7 +56,7 @@ #include "arm_compute/runtime/CL/functions/CLPoolingLayer.h" #include "arm_compute/runtime/CL/functions/CLSoftmaxLayer.h" -#include "model_objects/AlexNet.h" +#include "tests/validation_old/model_objects/AlexNet.h" #include <array> diff --git a/tests/validation/system_tests/CL/LeNet5.cpp b/tests/validation_old/system_tests/CL/LeNet5.cpp index 4b3d969a1d..0f34dd1ae7 100644 --- a/tests/validation/system_tests/CL/LeNet5.cpp +++ b/tests/validation_old/system_tests/CL/LeNet5.cpp @@ -46,7 +46,7 @@ * SOFTWARE. */ #include "CL/CLAccessor.h" -#include "validation/Validation.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/runtime/CL/functions/CLActivationLayer.h" #include "arm_compute/runtime/CL/functions/CLConvolutionLayer.h" @@ -54,7 +54,7 @@ #include "arm_compute/runtime/CL/functions/CLPoolingLayer.h" #include "arm_compute/runtime/CL/functions/CLSoftmaxLayer.h" -#include "model_objects/LeNet5.h" +#include "tests/validation_old/model_objects/LeNet5.h" using namespace arm_compute; using namespace arm_compute::test; diff --git a/tests/validation/system_tests/NEON/AlexNet.cpp b/tests/validation_old/system_tests/NEON/AlexNet.cpp index 20a612fd64..9697cf35e8 100644 --- a/tests/validation/system_tests/NEON/AlexNet.cpp +++ b/tests/validation_old/system_tests/NEON/AlexNet.cpp @@ -46,7 +46,7 @@ * SOFTWARE. */ #include "NEON/Accessor.h" -#include "validation/Validation.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/runtime/NEON/functions/NEActivationLayer.h" #include "arm_compute/runtime/NEON/functions/NEConvolutionLayer.h" @@ -56,7 +56,7 @@ #include "arm_compute/runtime/NEON/functions/NESoftmaxLayer.h" #include "arm_compute/runtime/SubTensor.h" -#include "model_objects/AlexNet.h" +#include "tests/validation_old/model_objects/AlexNet.h" #include <array> diff --git a/tests/validation/system_tests/NEON/LeNet5.cpp b/tests/validation_old/system_tests/NEON/LeNet5.cpp index c745613959..916df98eb6 100644 --- a/tests/validation/system_tests/NEON/LeNet5.cpp +++ b/tests/validation_old/system_tests/NEON/LeNet5.cpp @@ -46,7 +46,7 @@ * SOFTWARE. */ #include "NEON/Accessor.h" -#include "validation/Validation.h" +#include "tests/validation_old/Validation.h" #include "arm_compute/runtime/NEON/functions/NEActivationLayer.h" #include "arm_compute/runtime/NEON/functions/NEConvolutionLayer.h" @@ -54,7 +54,7 @@ #include "arm_compute/runtime/NEON/functions/NEPoolingLayer.h" #include "arm_compute/runtime/NEON/functions/NESoftmaxLayer.h" -#include "model_objects/LeNet5.h" +#include "tests/validation_old/model_objects/LeNet5.h" using namespace arm_compute; using namespace arm_compute::test; |