From f982deaefbe5fe5814487b27f7099829839b8666 Mon Sep 17 00:00:00 2001 From: Aron Virginas-Tar Date: Fri, 11 Oct 2019 14:07:53 +0100 Subject: IVGCVSW-3973 Add frontend for LOG_SOFTMAX Signed-off-by: Aron Virginas-Tar Change-Id: Ic6acc7176deea3753b32ce6340f642d19dce0e9f --- .../test/TestNameAndDescriptorLayerVisitor.cpp | 28 ++++++++++++++++++++++ .../test/TestNameAndDescriptorLayerVisitor.hpp | 26 ++++++++++++++++++++ 2 files changed, 54 insertions(+) (limited to 'src/armnn/test') diff --git a/src/armnn/test/TestNameAndDescriptorLayerVisitor.cpp b/src/armnn/test/TestNameAndDescriptorLayerVisitor.cpp index dcc5dc4cfb..e2bfb01733 100644 --- a/src/armnn/test/TestNameAndDescriptorLayerVisitor.cpp +++ b/src/armnn/test/TestNameAndDescriptorLayerVisitor.cpp @@ -328,6 +328,34 @@ BOOST_AUTO_TEST_CASE(CheckL2NormalizationLayerVisitorNameNullAndDescriptor) layer->Accept(visitor); } +BOOST_AUTO_TEST_CASE(CheckLogSoftmaxLayerVisitorNameAndDescriptor) +{ + const char* layerName = "LogSoftmaxLayer"; + + LogSoftmaxDescriptor descriptor; + descriptor.m_Beta = 2.0f; + descriptor.m_Axis = 1; + + TestLogSoftmaxLayerVisitor visitor(descriptor, layerName); + Network net; + + IConnectableLayer *const layer = net.AddLogSoftmaxLayer(descriptor, layerName); + layer->Accept(visitor); +} + +BOOST_AUTO_TEST_CASE(CheckLogSoftmaxLayerVisitorNameNullAndDescriptor) +{ + LogSoftmaxDescriptor descriptor; + descriptor.m_Beta = 2.0f; + descriptor.m_Axis = 1; + + TestLogSoftmaxLayerVisitor visitor(descriptor); + Network net; + + IConnectableLayer *const layer = net.AddLogSoftmaxLayer(descriptor); + layer->Accept(visitor); +} + BOOST_AUTO_TEST_CASE(CheckReshapeLayerVisitorNameAndDescriptor) { const char* layerName = "ReshapeLayer"; diff --git a/src/armnn/test/TestNameAndDescriptorLayerVisitor.hpp b/src/armnn/test/TestNameAndDescriptorLayerVisitor.hpp index aa0b3597fa..e46aa34e29 100644 --- a/src/armnn/test/TestNameAndDescriptorLayerVisitor.hpp +++ b/src/armnn/test/TestNameAndDescriptorLayerVisitor.hpp @@ -479,6 +479,32 @@ public: }; }; +class TestLogSoftmaxLayerVisitor : public TestLayerVisitor +{ +private: + LogSoftmaxDescriptor m_VisitorDescriptor; + +public: + explicit TestLogSoftmaxLayerVisitor(const LogSoftmaxDescriptor& descriptor, const char* name = nullptr) + : TestLayerVisitor(name) + , m_VisitorDescriptor(descriptor) {} + + void CheckDescriptor(const LogSoftmaxDescriptor& descriptor) + { + BOOST_CHECK_EQUAL(descriptor.m_Beta, m_VisitorDescriptor.m_Beta); + BOOST_CHECK_EQUAL(descriptor.m_Axis, m_VisitorDescriptor.m_Axis); + } + + void VisitLogSoftmaxLayer(const IConnectableLayer* layer, + const LogSoftmaxDescriptor& descriptor, + const char* name = nullptr) override + { + CheckLayerPointer(layer); + CheckDescriptor(descriptor); + CheckLayerName(name); + }; +}; + class TestReshapeLayerVisitor : public TestLayerVisitor { private: -- cgit v1.2.1