diff options
author | Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> | 2019-10-15 17:35:36 +0100 |
---|---|---|
committer | Áron Virginás-Tar <aron.virginas-tar@arm.com> | 2019-10-16 09:39:56 +0000 |
commit | 6fe5247f8997a04edfdd7c974c96a0a086ef3ab5 (patch) | |
tree | 52d6cc314797f7bf138a0b2d81491543e05b6900 /src/armnn/test/TestNameOnlyLayerVisitor.hpp | |
parent | 20bea0071d507772e303eb6f1c476bf1feac9be5 (diff) | |
download | armnn-6fe5247f8997a04edfdd7c974c96a0a086ef3ab5.tar.gz |
IVGCVSW-3991 Make Descriptor objects comparable and refactor LayerVisitor tests
* Implemented operator==() for Descriptor structs
* Refactored TestNameAndDescriptorLayerVisitor to eliminate code duplication
by using templates and taking advantage of the fact that descriptor objects
can now all be compared the same way using ==
* Cleaned up TestNameOnlylayerVisitor by moving all test cases for layers
that require a descriptor to TestNameAndDescriptorLayerVisitor
Signed-off-by: Aron Virginas-Tar <Aron.Virginas-Tar@arm.com>
Change-Id: Iee38b04d68d34a5f4ec7e5790de39ecb7ab0fb80
Diffstat (limited to 'src/armnn/test/TestNameOnlyLayerVisitor.hpp')
-rw-r--r-- | src/armnn/test/TestNameOnlyLayerVisitor.hpp | 55 |
1 files changed, 20 insertions, 35 deletions
diff --git a/src/armnn/test/TestNameOnlyLayerVisitor.hpp b/src/armnn/test/TestNameOnlyLayerVisitor.hpp index 4e0aa2f989..a772cb3283 100644 --- a/src/armnn/test/TestNameOnlyLayerVisitor.hpp +++ b/src/armnn/test/TestNameOnlyLayerVisitor.hpp @@ -9,51 +9,36 @@ namespace { -// Defines a visitor function with 1 required parameter to be used -// with layers that do not have a descriptor -#define VISIT_METHOD_1_PARAM(name) \ -void Visit##name##Layer(const armnn::IConnectableLayer* layer, const char* layerName = nullptr) override - -// Defines a visitor function with 2 required parameters to be used -// with layers that have a descriptor -#define VISIT_METHOD_2_PARAM(name) \ -void Visit##name##Layer(const armnn::IConnectableLayer* layer, \ - const armnn::name##Descriptor&, \ - const char* layerName = nullptr) override - -#define TEST_LAYER_VISITOR(name, numVisitorParams) \ +#define DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(name) \ class Test##name##LayerVisitor : public armnn::TestLayerVisitor \ { \ public: \ explicit Test##name##LayerVisitor(const char* layerName = nullptr) : armnn::TestLayerVisitor(layerName) {}; \ \ - VISIT_METHOD_##numVisitorParams##_PARAM(name) \ + void Visit##name##Layer(const armnn::IConnectableLayer* layer, \ + const char* layerName = nullptr) override \ { \ CheckLayerPointer(layer); \ CheckLayerName(layerName); \ } \ }; -// Defines a test layer visitor class for a layer, of a given name, -// that does not require a descriptor -#define TEST_LAYER_VISITOR_1_PARAM(name) TEST_LAYER_VISITOR(name, 1) - -// Defines a test layer visitor class for a layer, of a given name, -// that requires a descriptor -#define TEST_LAYER_VISITOR_2_PARAM(name) TEST_LAYER_VISITOR(name, 2) - } // anonymous namespace -TEST_LAYER_VISITOR_1_PARAM(Addition) -TEST_LAYER_VISITOR_2_PARAM(DepthToSpace) -TEST_LAYER_VISITOR_1_PARAM(Division) -TEST_LAYER_VISITOR_1_PARAM(Equal) -TEST_LAYER_VISITOR_1_PARAM(Floor) -TEST_LAYER_VISITOR_1_PARAM(Gather) -TEST_LAYER_VISITOR_1_PARAM(Greater) -TEST_LAYER_VISITOR_1_PARAM(Maximum) -TEST_LAYER_VISITOR_1_PARAM(Minimum) -TEST_LAYER_VISITOR_1_PARAM(Multiplication) -TEST_LAYER_VISITOR_1_PARAM(Rsqrt) -TEST_LAYER_VISITOR_2_PARAM(Slice) -TEST_LAYER_VISITOR_1_PARAM(Subtraction) +DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(Abs) +DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(Addition) +DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(Dequantize) +DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(Division) +DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(Equal) +DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(Floor) +DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(Gather) +DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(Greater) +DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(Maximum) +DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(Merge) +DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(Minimum) +DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(Multiplication) +DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(Prelu) +DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(Quantize) +DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(Rsqrt) +DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(Subtraction) +DECLARE_TEST_NAME_ONLY_LAYER_VISITOR_CLASS(Switch) |