aboutsummaryrefslogtreecommitdiff
path: root/src/backends/tosaReference
diff options
context:
space:
mode:
Diffstat (limited to 'src/backends/tosaReference')
-rw-r--r--src/backends/tosaReference/TosaRefLayerSupport.cpp6
-rw-r--r--src/backends/tosaReference/test/TosaRefEndToEndTests.cpp9
-rw-r--r--src/backends/tosaReference/test/TosaRefLayerSupportTests.cpp42
3 files changed, 53 insertions, 4 deletions
diff --git a/src/backends/tosaReference/TosaRefLayerSupport.cpp b/src/backends/tosaReference/TosaRefLayerSupport.cpp
index 6113b5861a..238801cb98 100644
--- a/src/backends/tosaReference/TosaRefLayerSupport.cpp
+++ b/src/backends/tosaReference/TosaRefLayerSupport.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2022-2023 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -68,6 +68,7 @@ bool TosaRefLayerSupport::IsLayerSupported(const LayerType& type,
}
break;
}
+ case LayerType::ElementwiseUnary:
case LayerType::Pooling2d:
case LayerType::Reshape:
case LayerType::Slice:
@@ -89,7 +90,8 @@ bool TosaRefLayerSupport::IsLayerSupported(const LayerType& type,
break;
}
default:
- break;
+ // Default to false for all unsupported layers.
+ return false;
}
auto mappings = GetTosaMapping(nullptr, type, inputInfos, outputInfos, descriptor);
diff --git a/src/backends/tosaReference/test/TosaRefEndToEndTests.cpp b/src/backends/tosaReference/test/TosaRefEndToEndTests.cpp
index e19462e986..26cadd22db 100644
--- a/src/backends/tosaReference/test/TosaRefEndToEndTests.cpp
+++ b/src/backends/tosaReference/test/TosaRefEndToEndTests.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2022-2023 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -11,6 +11,7 @@
#include "backendsCommon/test/MultiplicationEndToEndTestImpl.hpp"
#include "backendsCommon/test/Pooling2dEndToEndTestImpl.hpp"
#include "backendsCommon/test/ReshapeEndToEndTestImpl.hpp"
+#include "backendsCommon/test/ElementwiseUnaryEndToEndTestImpl.hpp"
#include "backendsCommon/test/SliceEndToEndTestImpl.hpp"
#include "backendsCommon/test/SubtractionEndToEndTestImpl.hpp"
#include "backendsCommon/test/TransposeConvolution2dEndToEndTestImpl.hpp"
@@ -138,6 +139,12 @@ TEST_CASE("TosaRefReshapeEndtoEndTestFloat16")
ReshapeEndToEndFloat16<DataType::Float16>(tosaDefaultBackends);
}
+TEST_CASE("TosaRefRsqrtEndtoEndTestFloat32")
+{
+ ElementwiseUnarySimpleEndToEnd<armnn::DataType::Float32>(tosaDefaultBackends,
+ UnaryOperation::Rsqrt);
+}
+
// Slice
TEST_CASE("TosaRefSliceEndtoEndTestFloat32")
{
diff --git a/src/backends/tosaReference/test/TosaRefLayerSupportTests.cpp b/src/backends/tosaReference/test/TosaRefLayerSupportTests.cpp
index 66dfbe8dff..e32894f0b6 100644
--- a/src/backends/tosaReference/test/TosaRefLayerSupportTests.cpp
+++ b/src/backends/tosaReference/test/TosaRefLayerSupportTests.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2022-2023 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -374,6 +374,46 @@ TEST_CASE("IsLayerSupportedTosaReferenceReshapeUnsupported")
CHECK(!supported);
}
+TEST_CASE("IsLayerSupportedTosaReferenceRsqrt")
+{
+ TensorShape shape0 = {2,2};
+ TensorShape outShape = {2,2};
+ TensorInfo in0(shape0, DataType::Float32);
+ TensorInfo out(outShape, DataType::Float32);
+
+ ElementwiseUnaryDescriptor desc(UnaryOperation::Rsqrt);
+ TosaRefLayerSupport supportChecker;
+ std::string reasonIfNotSupported;
+ auto supported = supportChecker.IsLayerSupported(LayerType::ElementwiseUnary,
+ {in0, out},
+ desc,
+ EmptyOptional(),
+ EmptyOptional(),
+ reasonIfNotSupported);
+
+ CHECK(supported);
+}
+
+TEST_CASE("IsLayerSupportedTosaReferenceRsqrtUnsupported")
+{
+ TensorShape shape0 = {1,1,3,4};
+ TensorShape outShape = {1,3,1,4};
+ TensorInfo in0(shape0, DataType::Signed64);
+ TensorInfo out(outShape, DataType::Signed64);
+
+ ElementwiseUnaryDescriptor desc(UnaryOperation::Rsqrt);
+ TosaRefLayerSupport supportChecker;
+ std::string reasonIfNotSupported;
+ auto supported = supportChecker.IsLayerSupported(LayerType::ElementwiseUnary,
+ {in0, out},
+ desc,
+ EmptyOptional(),
+ EmptyOptional(),
+ reasonIfNotSupported);
+
+ CHECK(!supported);
+}
+
TEST_CASE("IsLayerSupportedTosaReferenceSlice")
{
TensorShape inShape = {3,2,3};