From 93f0ad0016a6450670fbf650568f5724c7bbb63e Mon Sep 17 00:00:00 2001 From: Teresa Charlin Date: Thu, 23 Mar 2023 15:28:02 +0000 Subject: 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 Signed-off-by: Mike Kelly Change-Id: I36e0dbff33694182d1dba0c95d463506428e2f04 --- src/backends/reference/workloads/Ceil.hpp | 25 ++++++++++++++++++++++ .../reference/workloads/ElementwiseFunction.cpp | 5 +++-- .../workloads/RefElementwiseUnaryWorkload.cpp | 9 +++++++- 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 src/backends/reference/workloads/Ceil.hpp (limited to 'src/backends/reference/workloads') 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 + +namespace armnn +{ +template +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 #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>; // Unary template struct armnn::ElementwiseUnaryFunction>; +template struct armnn::ElementwiseUnaryFunction>; template struct armnn::ElementwiseUnaryFunction>; template struct armnn::ElementwiseUnaryFunction>; template struct armnn::ElementwiseUnaryFunction>; 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 inputs, st std::unique_ptr> output= MakeEncoder(outputInfo, outputs[0]->Map()); using AbsFunction = ElementwiseUnaryFunction>; + using CeilFunction = ElementwiseUnaryFunction>; using ExpFunction = ElementwiseUnaryFunction>; using LogFunction = ElementwiseUnaryFunction>; using NegFunction = ElementwiseUnaryFunction>; @@ -70,6 +72,11 @@ void RefElementwiseUnaryWorkload::Execute(std::vector 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); -- cgit v1.2.1