aboutsummaryrefslogtreecommitdiff
path: root/src/backends/reference
diff options
context:
space:
mode:
authorTeresa Charlin <teresa.charlinreyes@arm.com>2023-03-23 15:28:02 +0000
committerTeresaARM <teresa.charlinreyes@arm.com>2023-04-19 08:54:57 +0000
commit93f0ad0016a6450670fbf650568f5724c7bbb63e (patch)
treeefb5f687ff93bf34bae1fe9d218124b57c2681ac /src/backends/reference
parentacb3ec51e51542d3011ed87842f87c2261abaaff (diff)
downloadarmnn-93f0ad0016a6450670fbf650568f5724c7bbb63e.tar.gz
GitHub #640 Add support for CEIL operator
* Reference workload * TfLite Delegate * TfLite Parser * Serializer and Deserializer * Changed fallback tests in delegate to use COS instead of CEIL Signed-off-by: Teresa Charlin <teresa.charlinreyes@arm.com> Signed-off-by: Mike Kelly <mike.kelly@arm.com> Change-Id: I36e0dbff33694182d1dba0c95d463506428e2f04
Diffstat (limited to 'src/backends/reference')
-rw-r--r--src/backends/reference/workloads/Ceil.hpp25
-rw-r--r--src/backends/reference/workloads/ElementwiseFunction.cpp5
-rw-r--r--src/backends/reference/workloads/RefElementwiseUnaryWorkload.cpp9
3 files changed, 36 insertions, 3 deletions
diff --git a/src/backends/reference/workloads/Ceil.hpp b/src/backends/reference/workloads/Ceil.hpp
new file mode 100644
index 0000000000..2e415b9c0a
--- /dev/null
+++ b/src/backends/reference/workloads/Ceil.hpp
@@ -0,0 +1,25 @@
+//
+// Copyright © 2023 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#include <iostream>
+
+namespace armnn
+{
+template<typename T>
+struct ceil
+ {
+ typedef T result_type;
+ typedef T argument_type;
+
+ T
+ operator () (const T& inputData) const
+ {
+ return std::ceil(inputData);
+ }
+ };
+
+} //namespace armnn
diff --git a/src/backends/reference/workloads/ElementwiseFunction.cpp b/src/backends/reference/workloads/ElementwiseFunction.cpp
index 82bcf99287..c5b0ad1f24 100644
--- a/src/backends/reference/workloads/ElementwiseFunction.cpp
+++ b/src/backends/reference/workloads/ElementwiseFunction.cpp
@@ -1,14 +1,14 @@
//
-// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2017-2021,2023 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "ElementwiseFunction.hpp"
#include "Broadcast.hpp"
-#include <functional>
#include "Minimum.hpp"
#include "Maximum.hpp"
#include "Abs.hpp"
+#include "Ceil.hpp"
#include "Exp.hpp"
#include "Log.hpp"
#include "Rsqrt.hpp"
@@ -85,6 +85,7 @@ template struct armnn::ElementwiseBinaryFunction<std::not_equal_to<float>>;
// Unary
template struct armnn::ElementwiseUnaryFunction<armnn::abs<float>>;
+template struct armnn::ElementwiseUnaryFunction<armnn::ceil<float>>;
template struct armnn::ElementwiseUnaryFunction<armnn::exp<float>>;
template struct armnn::ElementwiseUnaryFunction<armnn::log<float>>;
template struct armnn::ElementwiseUnaryFunction<std::negate<float>>;
diff --git a/src/backends/reference/workloads/RefElementwiseUnaryWorkload.cpp b/src/backends/reference/workloads/RefElementwiseUnaryWorkload.cpp
index 4bd5a51a52..f4775e0c19 100644
--- a/src/backends/reference/workloads/RefElementwiseUnaryWorkload.cpp
+++ b/src/backends/reference/workloads/RefElementwiseUnaryWorkload.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2020-2023 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -10,6 +10,7 @@
#include "Encoders.hpp"
#include "RefWorkloadUtils.hpp"
#include "Abs.hpp"
+#include "Ceil.hpp"
#include "Exp.hpp"
#include "Log.hpp"
#include "Rsqrt.hpp"
@@ -56,6 +57,7 @@ void RefElementwiseUnaryWorkload::Execute(std::vector<ITensorHandle*> inputs, st
std::unique_ptr<Encoder<OutType>> output= MakeEncoder<OutType>(outputInfo, outputs[0]->Map());
using AbsFunction = ElementwiseUnaryFunction<abs<InType>>;
+ using CeilFunction = ElementwiseUnaryFunction<ceil<InType>>;
using ExpFunction = ElementwiseUnaryFunction<exp<InType>>;
using LogFunction = ElementwiseUnaryFunction<log<InType>>;
using NegFunction = ElementwiseUnaryFunction<std::negate<InType>>;
@@ -70,6 +72,11 @@ void RefElementwiseUnaryWorkload::Execute(std::vector<ITensorHandle*> inputs, st
AbsFunction(inShape, outShape, *input, *output);
break;
}
+ case UnaryOperation::Ceil:
+ {
+ CeilFunction(inShape, outShape, *input, *output);
+ break;
+ }
case UnaryOperation::Exp:
{
ExpFunction(inShape, outShape, *input, *output);