From fb55a5a31e9873087a4f4005b0f65bd154aa7282 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=98=A4=ED=98=95=EC=84=9D/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Thu, 21 Mar 2019 19:49:29 +0900 Subject: [PATCH] Remove simple operation in ARMComputeEx (#4814) Remve simple operation in ARMComputeEx except pack/unpack Signed-off-by: Hyeongseok Oh --- .../runtime/misc/functions/SimpleArgOperation.h | 63 ------- .../misc/functions/SimpleArithmeticAddition.h | 141 --------------- .../runtime/misc/functions/SimpleBatchToSpaceNd.h | 59 ------- .../runtime/misc/functions/SimpleCastLayer.h | 78 --------- .../runtime/misc/functions/SimpleDepthToSpace.h | 59 ------- .../runtime/misc/functions/SimpleEmbeddingLookup.h | 70 -------- .../misc/functions/SimpleHashtableLookupLayer.h | 56 ------ .../arm_compute/runtime/misc/functions/SimpleNeg.h | 49 ------ .../runtime/misc/functions/SimplePadLayer.h | 51 ------ .../runtime/misc/functions/SimpleSQRT.h | 49 ------ .../runtime/misc/functions/SimpleSpaceToBatchND.h | 60 ------- .../runtime/misc/functions/SimpleSpaceToDepth.h | 73 -------- .../runtime/misc/functions/SimpleTransposeConv.h | 68 -------- .../runtime/misc/functions/SimpleArgOperation.cpp | 189 --------------------- .../misc/functions/SimpleBatchToSpaceNd.cpp | 117 ------------- .../src/runtime/misc/functions/SimpleCastLayer.cpp | 88 ---------- .../runtime/misc/functions/SimpleDepthToSpace.cpp | 117 ------------- .../misc/functions/SimpleEmbeddingLookup.cpp | 116 ------------- .../misc/functions/SimpleHashtableLookupLayer.cpp | 145 ---------------- .../src/runtime/misc/functions/SimpleNeg.cpp | 83 --------- .../src/runtime/misc/functions/SimplePadLayer.cpp | 169 ------------------ .../src/runtime/misc/functions/SimpleSQRT.cpp | 61 ------- .../misc/functions/SimpleSpaceToBatchND.cpp | 148 ---------------- .../runtime/misc/functions/SimpleSpaceToDepth.cpp | 118 ------------- .../runtime/misc/functions/SimpleTransposeConv.cpp | 164 ------------------ runtimes/pure_arm_compute/src/compilation.cc | 160 +---------------- 26 files changed, 7 insertions(+), 2544 deletions(-) delete mode 100644 libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleArgOperation.h delete mode 100644 libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleArithmeticAddition.h delete mode 100644 libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleBatchToSpaceNd.h delete mode 100644 libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleCastLayer.h delete mode 100644 libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleDepthToSpace.h delete mode 100644 libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleEmbeddingLookup.h delete mode 100644 libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleHashtableLookupLayer.h delete mode 100644 libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleNeg.h delete mode 100644 libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimplePadLayer.h delete mode 100644 libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleSQRT.h delete mode 100644 libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleSpaceToBatchND.h delete mode 100644 libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleSpaceToDepth.h delete mode 100644 libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleTransposeConv.h delete mode 100644 libs/ARMComputeEx/src/runtime/misc/functions/SimpleArgOperation.cpp delete mode 100644 libs/ARMComputeEx/src/runtime/misc/functions/SimpleBatchToSpaceNd.cpp delete mode 100644 libs/ARMComputeEx/src/runtime/misc/functions/SimpleCastLayer.cpp delete mode 100644 libs/ARMComputeEx/src/runtime/misc/functions/SimpleDepthToSpace.cpp delete mode 100644 libs/ARMComputeEx/src/runtime/misc/functions/SimpleEmbeddingLookup.cpp delete mode 100644 libs/ARMComputeEx/src/runtime/misc/functions/SimpleHashtableLookupLayer.cpp delete mode 100644 libs/ARMComputeEx/src/runtime/misc/functions/SimpleNeg.cpp delete mode 100644 libs/ARMComputeEx/src/runtime/misc/functions/SimplePadLayer.cpp delete mode 100644 libs/ARMComputeEx/src/runtime/misc/functions/SimpleSQRT.cpp delete mode 100644 libs/ARMComputeEx/src/runtime/misc/functions/SimpleSpaceToBatchND.cpp delete mode 100644 libs/ARMComputeEx/src/runtime/misc/functions/SimpleSpaceToDepth.cpp delete mode 100644 libs/ARMComputeEx/src/runtime/misc/functions/SimpleTransposeConv.cpp diff --git a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleArgOperation.h b/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleArgOperation.h deleted file mode 100644 index c709dd0..0000000 --- a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleArgOperation.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __ARM_COMPUTE_MISC_SIMPLE_ARGOPERATION_H__ -#define __ARM_COMPUTE_MISC_SIMPLE_ARGOPERATION_H__ - -#include -#include - -#include "arm_compute/core/TypesEx.h" -#include "Utils.h" - -namespace arm_compute -{ -namespace misc -{ - -class SimpleArgOperation : public arm_compute::IFunction -{ -public: - SimpleArgOperation(void) - { - // DO NOTHING - } - -public: - /** Initialise input and output - * - * @param[in] input First tensor input. - * @param[out] output Output tensor. - * @param[in] axis Dimension along which to reduce. - * @param[in] _op_type Type of Argument Operation - */ - void configure(arm_compute::ITensor *input, arm_compute::ITensor *output, - std::vector axis, arm_compute::ArgOperation _op_type); - - void run() override; - -private: - arm_compute::ITensor *_input{nullptr}; - arm_compute::ITensor *_output{nullptr}; - std::vector _axis{}; - int _input_rank{0}; - arm_compute::ArgOperation _op_type{ArgOperation::MAX}; -}; - -} // namespace misc -} // namespace arm_compute - -#endif /*__ARM_COMPUTE_MISC_SIMPLE_ARGOPERATION_H__ */ diff --git a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleArithmeticAddition.h b/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleArithmeticAddition.h deleted file mode 100644 index 8e3e3c8..0000000 --- a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleArithmeticAddition.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file        SimpleArithmeticAddition.h - * @brief       This file contains SimpleArithmeticAddition class - * @ingroup     COM_AI_RUNTIME - */ - -#ifndef __ARM_COMPUTE_MISC_SIMPLE_ARITHMETIC_ADDITION_H__ -#define __ARM_COMPUTE_MISC_SIMPLE_ARITHMETIC_ADDITION_H__ - -#include - -#include "Utils.h" - -namespace arm_compute -{ -namespace misc -{ - -/** - * @brief Class to run SimpleArithmeticAddition Layer - */ -class SimpleArithmeticAddition : public arm_compute::IFunction -{ -public: - SimpleArithmeticAddition(void) : _lhs(nullptr), _rhs(nullptr), _out(nullptr) - { - // DO NOTHING - } - - /** - * @brief Configure the layer - * @param[in] lhs Lefthand-side operand - * @param[in] rhs Righthand-side operand - * @param[in] out The destination tensor(Result operand) - * @return N/A - */ - void configure(arm_compute::ITensor *lhs, arm_compute::ITensor *rhs, arm_compute::ITensor *out) - { - _lhs = lhs; - _rhs = rhs; - _out = out; - } - -public: - /** - * @brief Run the operation. Must be called after configure(). - * @return N/A - */ - void run(void) override - { - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_lhs)->map(q); - CAST_CL(_rhs)->map(q); - CAST_CL(_out)->map(q); - } - - arm_compute::Window window; - window.use_tensor_dimensions(_out->info()->tensor_shape()); - - execute_window_loop(window, [this](const arm_compute::Coordinates &id) { - // NOTE Must be two input tensors of identical type - // Must be output tensor of the same type as input0. - assert(_lhs->info()->data_type() == _rhs->info()->data_type()); - assert(_lhs->info()->data_type() == _out->info()->data_type()); - - switch (_lhs->info()->data_type()) - { - case arm_compute::DataType::F32: - { - const auto lhs_value = *reinterpret_cast(_lhs->ptr_to_element(id)); - const auto rhs_value = *reinterpret_cast(_rhs->ptr_to_element(id)); - *reinterpret_cast(_out->ptr_to_element(id)) = lhs_value + rhs_value; - break; - } - case arm_compute::DataType::S32: - { - const auto lhs_value = *reinterpret_cast(_lhs->ptr_to_element(id)); - const auto rhs_value = *reinterpret_cast(_rhs->ptr_to_element(id)); - *reinterpret_cast(_out->ptr_to_element(id)) = lhs_value + rhs_value; - break; - } - case arm_compute::DataType::U32: - { - const auto lhs_value = *reinterpret_cast(_lhs->ptr_to_element(id)); - const auto rhs_value = *reinterpret_cast(_rhs->ptr_to_element(id)); - *reinterpret_cast(_out->ptr_to_element(id)) = lhs_value + rhs_value; - break; - } - case arm_compute::DataType::QASYMM8: - { - const auto lhs_value = *reinterpret_cast(_lhs->ptr_to_element(id)); - const auto rhs_value = *reinterpret_cast(_rhs->ptr_to_element(id)); - // How to handle with overflow? - *reinterpret_cast(_out->ptr_to_element(id)) = lhs_value + rhs_value; - break; - } - default: - throw std::runtime_error("Not supported, yet"); - break; - } - }); - - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_out)->unmap(q); - CAST_CL(_rhs)->unmap(q); - CAST_CL(_lhs)->unmap(q); - } - } - -private: - arm_compute::ITensor *_lhs; - arm_compute::ITensor *_rhs; - arm_compute::ITensor *_out; -}; - -} // namespace misc -} // namespace arm_compute - -#endif // __ARM_COMPUTE_MISC_SIMPLE_ARITHMETIC_ADDITION_H__ diff --git a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleBatchToSpaceNd.h b/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleBatchToSpaceNd.h deleted file mode 100644 index 9178514..0000000 --- a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleBatchToSpaceNd.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - *Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __ARM_COMPUTE_MISC_SIMPLE_BATCH_TO_SPACE_ND_H__ -#define __ARM_COMPUTE_MISC_SIMPLE_BATCH_TO_SPACE_ND_H__ - -#include -#include "Utils.h" - -namespace arm_compute -{ -namespace misc -{ - -class SimpleBatchToSpaceND : public arm_compute::IFunction -{ -public: - SimpleBatchToSpaceND(void) : _input(nullptr), _output(nullptr), _block_size(nullptr), _axises{} - { - // DO NOTHING - } - - /** Initialise input and output - * - * @param[in] input First tensor input. - * @param[out] output Output tensor. - * @param[in] block_size Block size. - * @param[in] axises Axises of rank 4 - */ - void configure(arm_compute::ITensor *input, arm_compute::ITensor *output, - const int32_t *block_size, - const arm_compute::Coordinates &axises = utils::getARMComputeAxises(4)); - - void run() override; - -private: - arm_compute::ITensor *_input; - arm_compute::ITensor *_output; - const int32_t *_block_size; - arm_compute::Coordinates _axises; -}; - -} // namespace misc -} // namespace arm_compute - -#endif /*__ARM_COMPUTE_MISC_SIMPLE_BATCH_TO_SPACE_ND_H__ */ diff --git a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleCastLayer.h b/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleCastLayer.h deleted file mode 100644 index 8b77963..0000000 --- a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleCastLayer.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file        SimpleCastLayer.h - * @brief       This file contains SimpleCastLayer class - * @ingroup     COM_AI_RUNTIME - */ - -#ifndef __ARM_COMPUTE_MISC_CAST_LAYER_H__ -#define __ARM_COMPUTE_MISC_CAST_LAYER_H__ - -#include - -#include "Utils.h" - -namespace arm_compute -{ -namespace misc -{ -/** - * @brief Class to run SimpleCast Layer - */ -class SimpleCastLayer : public arm_compute::IFunction -{ -public: - SimpleCastLayer(void) : _in(nullptr), _out(nullptr) - { - // DO NOTHING - } - - /** - * @brief Configure the layer - * @param[in] in The source tensor - * @param[in] out The destination tensor - * @return N/A - */ - void configure(arm_compute::ITensor *in, arm_compute::ITensor *out); - - /** - * @brief Run the operation. Must be called after configure(). - * @return N/A - */ - void run(void) override; - -private: - /** - * @brief Cast and copy data from one tensor to another - * - * @param[in] in The source tensor - * @param[out] out The destination tensor - * @param[in] id Coordinates to copy - * @return N/A - */ - void castData(arm_compute::ITensor *in, arm_compute::ITensor *out, - const arm_compute::Coordinates &id); - - arm_compute::ITensor *_in; - arm_compute::ITensor *_out; -}; - -} // namespace misc -} // namespace arm_compute - -#endif // __ARM_COMPUTE_MISC_CAST_LAYER_H__ diff --git a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleDepthToSpace.h b/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleDepthToSpace.h deleted file mode 100644 index 6c1b625..0000000 --- a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleDepthToSpace.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __ARM_COMPUTE_MISC_DEPTH_TO_SPACE_H__ -#define __ARM_COMPUTE_MISC_DEPTH_TO_SPACE_H__ - -#include -#include "Utils.h" - -namespace arm_compute -{ -namespace misc -{ - -class SimpleDepthToSpace : public arm_compute::IFunction -{ -public: - SimpleDepthToSpace(void) : _input(nullptr), _output(nullptr), _block_size(0), _axises{} - { - // DO NOTHING - } - -public: - /** Initialise input and output - * - * @param[in] input First tensor input. - * @param[out] output Output tensor. - * @param[in] block_size Block size. - * @param[in] axises Axises of rank 4 - */ - void configure(arm_compute::ITensor *input, arm_compute::ITensor *output, int32_t block_size, - const arm_compute::Coordinates &axises = utils::getARMComputeAxises(4)); - - void run() override; - -private: - arm_compute::ITensor *_input; - arm_compute::ITensor *_output; - int32_t _block_size; - arm_compute::Coordinates _axises; -}; - -} // namespace misc -} // namespace arm_compute - -#endif /*__ARM_COMPUTE_MISC_DEPTH_TO_SPACE_H__ */ diff --git a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleEmbeddingLookup.h b/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleEmbeddingLookup.h deleted file mode 100644 index 9f6e43b..0000000 --- a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleEmbeddingLookup.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef __ARM_COMPUTE_MISC_EMBEDDING_LOOKUP_H__ -#define __ARM_COMPUTE_MISC_EMBEDDING_LOOKUP_H__ - -#include - -#include "Utils.h" - -/** - * @file        SimpleEmbeddingLookup.h - * @brief       This file contains SimpleEmbeddingLookup class - * @ingroup     COM_AI_RUNTIME - */ -namespace arm_compute -{ -namespace misc -{ - -/** - * @brief Class to run SimpleEmbeddingLookup Layer - */ -class SimpleEmbeddingLookup : public arm_compute::IFunction -{ -public: - SimpleEmbeddingLookup(void) : _lookups(nullptr), _values(nullptr), _output(nullptr) - { - // DO NOTHING - } - -public: - /** - * @brief Configure the layer - * @param[in] lookups 1D tensor which contains lookup values - * @param[in] values The source tensor - * @param[in] output The destination tensor - * @return N/A - */ - void configure(arm_compute::ITensor *lookups, arm_compute::ITensor *values, - arm_compute::ITensor *output); - - /** - * @brief Run the operation. Must be called after configure(). - * @return N/A - */ - void run() override; - -private: - arm_compute::ITensor *_lookups; - arm_compute::ITensor *_values; - arm_compute::ITensor *_output; -}; - -} // namespace misc -} // namespace arm_compute - -#endif /*__ARM_COMPUTE_MISC_EMBEDDING_LOOKUP_H__ */ diff --git a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleHashtableLookupLayer.h b/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleHashtableLookupLayer.h deleted file mode 100644 index 102f482..0000000 --- a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleHashtableLookupLayer.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __ARM_COMPUTE_MISC_HASHTABLE_LOOKUP_H__ -#define __ARM_COMPUTE_MISC_HASHTABLE_LOOKUP_H__ - -#include - -#include "Utils.h" - -namespace arm_compute -{ -namespace misc -{ - -class SimpleHashtableLookupLayer : public arm_compute::IFunction -{ -public: - SimpleHashtableLookupLayer(void) - : _lookups(nullptr), _keys(nullptr), _values(nullptr), _output(nullptr), _hits(nullptr) - { - // DO NOTHING - } - - void configure(arm_compute::ITensor *lookups, arm_compute::ITensor *keys, - arm_compute::ITensor *values, arm_compute::ITensor *output, - arm_compute::ITensor *hits); - - void run() override; - -private: - arm_compute::ITensor *_lookups; - arm_compute::ITensor *_keys; - arm_compute::ITensor *_values; - arm_compute::ITensor *_output; - arm_compute::ITensor *_hits; - std::vector _lookup_indices; -}; - -} // namespace misc -} // namespace arm_compute - -#endif /*__ARM_COMPUTE_MISC_HASHTABLE_LOOKUP_H__ */ diff --git a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleNeg.h b/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleNeg.h deleted file mode 100644 index 6614ee1..0000000 --- a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleNeg.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __ARM_COMPUTE_MISC_NEG_H__ -#define __ARM_COMPUTE_MISC_NEG_H__ - -#include - -#include "Utils.h" - -namespace arm_compute -{ -namespace misc -{ - -class SimpleNeg : public arm_compute::IFunction -{ -public: - SimpleNeg(void) : _input(nullptr), _output(nullptr) - { - // DO NOTHING - } - - void configure(arm_compute::ITensor *input, arm_compute::ITensor *output); - - void run() override; - -private: - arm_compute::ITensor *_input; - arm_compute::ITensor *_output; -}; - -} // namespace misc -} // namespace arm_compute - -#endif /*__ARM_COMPUTE_MISC_NEG_H__ */ diff --git a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimplePadLayer.h b/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimplePadLayer.h deleted file mode 100644 index c470770..0000000 --- a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimplePadLayer.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __ARM_COMPUTE_MISC_PAD_LAYER_H__ -#define __ARM_COMPUTE_MISC_PAD_LAYER_H__ - -#include - -#include "Utils.h" - -namespace arm_compute -{ -namespace misc -{ - -class SimplePadLayer : public arm_compute::IFunction -{ -public: - SimplePadLayer(void) : _input(nullptr), _output(nullptr), _padding_size(nullptr) - { - // DO NOTHING - } - - void configure(arm_compute::ITensor *input, arm_compute::ITensor *output, - arm_compute::ITensor *padding_size); - - void run(void) override; - -private: - arm_compute::ITensor *_input; - arm_compute::ITensor *_output; - arm_compute::ITensor *_padding_size; -}; - -} // namespace misc -} // namespace arm_compute - -#endif // __ARM_COMPUTE_MISC_PAD_LAYER_H__ diff --git a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleSQRT.h b/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleSQRT.h deleted file mode 100644 index 9cf0e57..0000000 --- a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleSQRT.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __ARM_COMPUTE_MISC_SQRT_H__ -#define __ARM_COMPUTE_MISC_SQRT_H__ - -#include - -#include "Utils.h" - -namespace arm_compute -{ -namespace misc -{ - -class SimpleSQRT : public arm_compute::IFunction -{ -public: - SimpleSQRT(void) : _input(nullptr), _output(nullptr) - { - // DO NOTHING - } - - void configure(arm_compute::ITensor *input, arm_compute::ITensor *output); - - void run() override; - -private: - arm_compute::ITensor *_input; - arm_compute::ITensor *_output; -}; - -} // namespace misc -} // namespace arm_compute - -#endif /*__ARM_COMPUTE_MISC_SQRT_H__ */ diff --git a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleSpaceToBatchND.h b/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleSpaceToBatchND.h deleted file mode 100644 index 9598dab..0000000 --- a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleSpaceToBatchND.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __ARM_COMPUTE_MISC_SPACE_TO_BATCHND_H__ -#define __ARM_COMPUTE_MISC_SPACE_TO_BATCHND_H__ - -#include - -#include "Utils.h" - -namespace arm_compute -{ -namespace misc -{ - -class SimpleSpaceToBatchND : public arm_compute::IFunction -{ -public: - SimpleSpaceToBatchND(void) - : _input(nullptr), _block_size(nullptr), _padding_size(nullptr), _output(nullptr) - { - // DO NOTHING - } - - /** Initialise input and output - * - * @param[in] input First tensor input. - * @param[in] block_size Block size. - * @param[in] padding_size Padding size. - * @param[out] output Output tensor. - */ - void configure(arm_compute::ITensor *input, arm_compute::ITensor *block_size, - arm_compute::ITensor *padding_size, arm_compute::ITensor *output); - - void run() override; - -private: - arm_compute::ITensor *_input; - arm_compute::ITensor *_block_size; - arm_compute::ITensor *_padding_size; - arm_compute::ITensor *_output; -}; - -} // namespace misc -} // namespace arm_compute - -#endif /*__ARM_COMPUTE_MISC_SPACE_TO_BATCHND_H__ */ diff --git a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleSpaceToDepth.h b/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleSpaceToDepth.h deleted file mode 100644 index 22a5878..0000000 --- a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleSpaceToDepth.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file        SimpleSpaceToDepth.h - * @brief       This file contains SimpleSpaceToDepth class - * @ingroup     COM_AI_RUNTIME - */ - -#ifndef __ARM_COMPUTE_MISC_SPACE_TO_DEPTH_H__ -#define __ARM_COMPUTE_MISC_SPACE_TO_DEPTH_H__ - -#include - -#include "Utils.h" - -namespace arm_compute -{ -namespace misc -{ - -/** - * @brief Class to run SimpleEmbeddingLookup Layer - */ -class SimpleSpaceToDepth : public arm_compute::IFunction -{ -public: - SimpleSpaceToDepth(void) : _input(nullptr), _output(nullptr), _block_size(0), _axises{} - { - // DO NOTHING - } - - /** - * @brief Configure the layer - * @param[in] input First tensor input. - * @param[in] output Output tensor. - * @param[in] block_size Block size. - * @param[in] axises Axises of rank 4 - * @return N/A - */ - void configure(arm_compute::ITensor *input, arm_compute::ITensor *output, int32_t block_size, - const arm_compute::Coordinates &axises = utils::getARMComputeAxises(4)); - - /** - * @brief Run the operation. Must be called after configure(). - * @return N/A - */ - void run() override; - -private: - arm_compute::ITensor *_input; - arm_compute::ITensor *_output; - int32_t _block_size; - arm_compute::Coordinates _axises; -}; - -} // namespace misc -} // namespace arm_compute - -#endif /*__ARM_COMPUTE_MISC_SPACE_TO_DEPTH_H__ */ diff --git a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleTransposeConv.h b/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleTransposeConv.h deleted file mode 100644 index 7bc9df1..0000000 --- a/libs/ARMComputeEx/arm_compute/runtime/misc/functions/SimpleTransposeConv.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __TRANSPOSE_CONV_EX__ -#define __TRANSPOSE_CONV_EX__ - -#include - -#include "Utils.h" - -namespace arm_compute -{ -namespace misc -{ - -class SimpleTransposeConv : public arm_compute::IFunction -{ -public: - SimpleTransposeConv() - : _input(nullptr), _weights(nullptr), _output(nullptr), _stride_width(0), _stride_height(0), - _pad_width(0), _pad_height(0) - { - // DO NOTHING - } - - /** Initialise input and output - * - * @param[in] input First tensor input. - * @param[in] weights Weights - * @param[out] output Output tensor. - * @param[in] tc_info Contains padding and policies to be used in the deconvolution, - * this is decribed in @ref PadStrideInfo. - * @param[in] axises Axises of rank 4 - */ - void configure(arm_compute::ITensor *input, arm_compute::ITensor *weights, - arm_compute::ITensor *output, arm_compute::PadStrideInfo &tconv_info, - arm_compute::Coordinates axises = utils::getARMComputeAxises(4)); - - void run() override; - -private: - arm_compute::ITensor *_input; - arm_compute::ITensor *_weights; - arm_compute::ITensor *_output; - int32_t _stride_width; - int32_t _stride_height; - int32_t _pad_width; - int32_t _pad_height; - arm_compute::Coordinates _axises; -}; - -} // namespace misc -} // namespace arm_compute - -#endif /*__TRANSPOSE_CONV_EX__ */ diff --git a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleArgOperation.cpp b/libs/ARMComputeEx/src/runtime/misc/functions/SimpleArgOperation.cpp deleted file mode 100644 index 5b0b1e1..0000000 --- a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleArgOperation.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include "arm_compute/runtime/misc/functions/SimpleArgOperation.h" - -namespace arm_compute -{ -namespace misc -{ - -void SimpleArgOperation::configure(arm_compute::ITensor *input, arm_compute::ITensor *output, - std::vector axis, arm_compute::ArgOperation op) -{ - _input = input; - _output = output; - _axis = axis; - _input_rank = input->info()->num_dimensions(); - _op_type = op; -} - -inline const arm_compute::TensorShape inferOutputShape(const arm_compute::TensorShape &input_shape, - const std::vector &axis, - int input_rank) -{ - arm_compute::TensorShape out_shape{}; - size_t dim = 1; - for (int i = 0; i < input_rank; ++i) - { - dim = input_shape[i]; - out_shape.set(i, dim); - } - - for (size_t i = 0; i < axis.size(); ++i) - { - out_shape.set(axis[i], 1); - } - - return out_shape; -} - -template -inline T getArgOpEle(const arm_compute::ITensor *input, const arm_compute::TensorShape &input_shape, - const arm_compute::TensorShape &output_shape, const size_t b, const size_t d, - const size_t h, const size_t w, const int axis, - const arm_compute::ArgOperation op_type) -{ - // If output[dimention] == 1, will check all values of that dimension because of reducing - // dimension. - // Else will check only one value. - const size_t start_b = output_shape[3] == 1 ? 0 : b; - const size_t start_d = output_shape[2] == 1 ? 0 : d; - const size_t start_h = output_shape[1] == 1 ? 0 : h; - const size_t start_w = output_shape[0] == 1 ? 0 : w; - const size_t stop_b = output_shape[3] == 1 ? input_shape[3] - 1 : b; - const size_t stop_d = output_shape[2] == 1 ? input_shape[2] - 1 : d; - const size_t stop_h = output_shape[1] == 1 ? input_shape[1] - 1 : h; - const size_t stop_w = output_shape[0] == 1 ? input_shape[0] - 1 : w; - - arm_compute::Coordinates id{w, h, d, b}; - arm_compute::Coordinates min_max_id{w, h, d, b}; - - T value = *reinterpret_cast(input->ptr_to_element(id)); - T tval = *reinterpret_cast(input->ptr_to_element(id)); - - for (size_t in_b = start_b; in_b <= stop_b; ++in_b) - { - id.set(3, in_b); - for (size_t in_d = start_d; in_d <= stop_d; ++in_d) - { - id.set(2, in_d); - for (size_t in_h = start_h; in_h <= stop_h; ++in_h) - { - id.set(1, in_h); - for (size_t in_w = start_w; in_w <= stop_w; ++in_w) - { - id.set(0, in_w); - if (op_type == arm_compute::ArgOperation::MIN) - { - value = std::min(value, *reinterpret_cast(input->ptr_to_element(id))); - } - else if (op_type == arm_compute::ArgOperation::MAX) - { - value = std::max(value, *reinterpret_cast(input->ptr_to_element(id))); - } - else - throw std::runtime_error("This Arg operation is not supported, yet"); - - if (tval != value) - { - min_max_id = id; - tval = value; - } - } - } - } - } - - return min_max_id[axis]; -} - -template -inline void -getArgOperation(const arm_compute::ITensor *input, const arm_compute::TensorShape &input_shape, - const arm_compute::TensorShape &output_shape, arm_compute::ITensor *output, - const int axis, const arm_compute::ArgOperation op_type) -{ - arm_compute::Coordinates id; - for (size_t out_b = 0; out_b < output_shape[3]; ++out_b) - { - id.set(3, out_b); - for (size_t out_d = 0; out_d < output_shape[2]; ++out_d) - { - id.set(2, out_d); - for (size_t out_h = 0; out_h < output_shape[1]; ++out_h) - { - id.set(1, out_h); - for (size_t out_w = 0; out_w < output_shape[0]; ++out_w) - { - id.set(0, out_w); - *reinterpret_cast(output->ptr_to_element(id)) = getArgOpEle( - input, input_shape, output_shape, out_b, out_d, out_h, out_w, axis, op_type); - } - } - } - } -} - -void SimpleArgOperation::run() -{ - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_input)->map(q); - CAST_CL(_output)->map(q); - } - - arm_compute::TensorShape input_shape = _input->info()->tensor_shape(); - - // Axis dimension is 1 and size is 1. - // TODO support axis size > 1. - int axis_val = _axis[0]; - arm_compute::TensorShape output_shape = inferOutputShape(input_shape, _axis, _input_rank); - - _output->info()->set_tensor_shape(output_shape); - switch (_input->info()->data_type()) - { - case arm_compute::DataType::QASYMM8: - getArgOperation(_input, input_shape, output_shape, _output, axis_val, _op_type); - break; - case arm_compute::DataType::S32: - getArgOperation(_input, input_shape, output_shape, _output, axis_val, _op_type); - break; - case arm_compute::DataType::F32: - getArgOperation(_input, input_shape, output_shape, _output, axis_val, _op_type); - break; - default: - ARM_COMPUTE_ERROR("DataType not supported"); - break; - } - - _output->info()->set_tensor_shape(output_shape); - - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_input)->unmap(q); - CAST_CL(_output)->unmap(q); - } -} - -} // namespace misc -} // namespace arm_compute diff --git a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleBatchToSpaceNd.cpp b/libs/ARMComputeEx/src/runtime/misc/functions/SimpleBatchToSpaceNd.cpp deleted file mode 100644 index 9268a3a..0000000 --- a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleBatchToSpaceNd.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include "arm_compute/runtime/misc/functions/SimpleBatchToSpaceNd.h" - -namespace arm_compute -{ -namespace misc -{ - -void SimpleBatchToSpaceND::configure(arm_compute::ITensor *input, arm_compute::ITensor *output, - const int32_t *block_size, - const arm_compute::Coordinates &axises) -{ - const auto rank = axises.num_dimensions(); - assert(rank == 4); - - for (uint32_t i = 0; i < rank; ++i) - assert(axises[i] >= 0 && (uint32_t)axises[i] < rank); - - _input = input; - _output = output; - _block_size = block_size; - _axises = axises; -} - -template -inline void -BatchToSpaceND(const arm_compute::ITensor *input, const arm_compute::TensorShape & /*input_shape*/, - const int32_t *block_size_data, arm_compute::ITensor *output, - const arm_compute::TensorShape &output_shape, const arm_compute::Coordinates &axises) -{ - const int output_batch = output_shape[axises[0]]; - const int output_height = output_shape[axises[1]]; - const int output_width = output_shape[axises[2]]; - const int depth = output_shape[axises[3]]; - - for (int out_b = 0; out_b < output_batch; ++out_b) - { - for (int out_h = 0; out_h < output_height; ++out_h) - { - for (int out_w = 0; out_w < output_width; ++out_w) - { - for (int out_d = 0; out_d < depth; ++out_d) - { - const int in_d = out_d; - const int in_h = out_h / block_size_data[0]; - const int in_w = out_w / block_size_data[1]; - const int in_b = - out_b + - ((out_h % block_size_data[0]) * block_size_data[1] + out_w % block_size_data[1]) * - output_batch; - - auto input_id = utils::asARMComputeCoordinates( - arm_compute::Coordinates{in_b, in_h, in_w, in_d}, axises); - auto output_id = utils::asARMComputeCoordinates( - arm_compute::Coordinates{out_b, out_h, out_w, out_d}, axises); - - *reinterpret_cast(output->ptr_to_element(output_id)) = - *reinterpret_cast(input->ptr_to_element(input_id)); - } - } - } - } -} -void SimpleBatchToSpaceND::run() -{ - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_input)->map(q); - CAST_CL(_output)->map(q); - } - - switch (_input->info()->data_type()) - { - case arm_compute::DataType::U8: - case arm_compute::DataType::QASYMM8: - BatchToSpaceND(_input, _input->info()->tensor_shape(), _block_size, _output, - _output->info()->tensor_shape(), _axises); - break; - case arm_compute::DataType::F32: - BatchToSpaceND(_input, _input->info()->tensor_shape(), _block_size, _output, - _output->info()->tensor_shape(), _axises); - break; - default: - ARM_COMPUTE_ERROR("DataType not supported"); - break; - } - - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_input)->unmap(q); - CAST_CL(_output)->unmap(q); - } -} - -} // namespace misc -} // namespace arm_compute diff --git a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleCastLayer.cpp b/libs/ARMComputeEx/src/runtime/misc/functions/SimpleCastLayer.cpp deleted file mode 100644 index 54204a9..0000000 --- a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleCastLayer.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include "arm_compute/runtime/misc/functions/SimpleCastLayer.h" - -namespace arm_compute -{ -namespace misc -{ - -void SimpleCastLayer::castData(arm_compute::ITensor *in, arm_compute::ITensor *out, - const arm_compute::Coordinates &id) -{ - switch (in->info()->data_type()) - { - case arm_compute::DataType::F32: - { - utils::copyCast(*reinterpret_cast(in->ptr_to_element(id)), out, id); - break; - } - case arm_compute::DataType::S32: - { - utils::copyCast(*reinterpret_cast(in->ptr_to_element(id)), out, id); - break; - } - case arm_compute::DataType::U32: - { - utils::copyCast(*reinterpret_cast(in->ptr_to_element(id)), out, id); - break; - } - case arm_compute::DataType::QASYMM8: - { - const uint8_t quantizedValue = *(in->ptr_to_element(id)); - utils::copyCast(in->info()->quantization_info().dequantize(quantizedValue), out, id); - break; - } - default: - throw std::runtime_error("Not supported, yet"); - break; - } -} - -void SimpleCastLayer::configure(arm_compute::ITensor *in, arm_compute::ITensor *out) -{ - _in = in; - _out = out; -} - -void SimpleCastLayer::run(void) -{ - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - CAST_CL(_in)->map(q); - CAST_CL(_out)->map(q); - } - - arm_compute::Window window; - window.use_tensor_dimensions(_out->info()->tensor_shape()); - - execute_window_loop(window, - [this](const arm_compute::Coordinates &id) { castData(_in, _out, id); }); - - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - CAST_CL(_out)->unmap(q); - CAST_CL(_in)->unmap(q); - } -} - -} // namespace misc -} // namespace arm_compute diff --git a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleDepthToSpace.cpp b/libs/ARMComputeEx/src/runtime/misc/functions/SimpleDepthToSpace.cpp deleted file mode 100644 index a04e0b1..0000000 --- a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleDepthToSpace.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include "arm_compute/runtime/misc/functions/SimpleDepthToSpace.h" - -namespace arm_compute -{ -namespace misc -{ - -void SimpleDepthToSpace::configure(arm_compute::ITensor *input, arm_compute::ITensor *output, - int32_t block_size, const arm_compute::Coordinates &axises) -{ - const auto rank = axises.num_dimensions(); - assert(rank == 4); - for (uint32_t i = 0; i < rank; ++i) - { - assert(axises[i] >= 0); - assert((uint32_t)axises[i] < rank); - } - - _input = input; - _output = output; - _block_size = block_size; - _axises = axises; -} - -template -inline void DepthToSpace(const arm_compute::ITensor *input, - const arm_compute::TensorShape & /*input_shape*/, int32_t block_size, - arm_compute::ITensor *output, const arm_compute::TensorShape &output_shape, - const arm_compute::Coordinates &axises) -{ - const int output_batch = output_shape[axises[0]]; - const int output_height = output_shape[axises[1]]; - const int output_width = output_shape[axises[2]]; - const int output_depth = output_shape[axises[3]]; - - for (int out_b = 0; out_b < output_batch; ++out_b) - { - for (int out_h = 0; out_h < output_height; ++out_h) - { - for (int out_w = 0; out_w < output_width; ++out_w) - { - for (int out_d = 0; out_d < output_depth; ++out_d) - { - const int in_b = out_b; - const int in_h = out_h / block_size; - const int in_w = out_w / block_size; - const int in_d = - out_d + ((out_h % block_size) * block_size + out_w % block_size) * output_depth; - - auto input_id = utils::asARMComputeCoordinates( - arm_compute::Coordinates{in_b, in_h, in_w, in_d}, axises); - auto output_id = utils::asARMComputeCoordinates( - arm_compute::Coordinates{out_b, out_h, out_w, out_d}, axises); - - *reinterpret_cast(output->ptr_to_element(output_id)) = - *reinterpret_cast(input->ptr_to_element(input_id)); - } - } - } - } -} - -void SimpleDepthToSpace::run() -{ - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_input)->map(q); - CAST_CL(_output)->map(q); - } - - switch (_input->info()->data_type()) - { - case arm_compute::DataType::U8: - case arm_compute::DataType::QASYMM8: - DepthToSpace(_input, _input->info()->tensor_shape(), _block_size, _output, - _output->info()->tensor_shape(), _axises); - break; - case arm_compute::DataType::F32: - DepthToSpace(_input, _input->info()->tensor_shape(), _block_size, _output, - _output->info()->tensor_shape(), _axises); - break; - default: - ARM_COMPUTE_ERROR("DataType not supported"); - break; - } - - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_input)->unmap(q); - CAST_CL(_output)->unmap(q); - } -} - -} // namespace misc -} // namespace arm_compute diff --git a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleEmbeddingLookup.cpp b/libs/ARMComputeEx/src/runtime/misc/functions/SimpleEmbeddingLookup.cpp deleted file mode 100644 index a6a31f0..0000000 --- a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleEmbeddingLookup.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include - -#include "arm_compute/runtime/misc/functions/SimpleEmbeddingLookup.h" - -namespace arm_compute -{ -namespace misc -{ - -void SimpleEmbeddingLookup::configure(arm_compute::ITensor *lookups, arm_compute::ITensor *values, - arm_compute::ITensor *output) -{ - assert(values->info()->num_dimensions() == output->info()->num_dimensions()); - assert(values->info()->num_dimensions() > 1 && values->info()->num_dimensions() <= 4); - _lookups = lookups; - _values = values; - _output = output; -} - -void SimpleEmbeddingLookup::run() -{ - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_lookups)->map(q); - CAST_CL(_values)->map(q); - CAST_CL(_output)->map(q); - } - - // type of elements of lookups is always integer - const int32_t *lookups_buf = reinterpret_cast(_lookups->buffer()); - - const auto lookups_info = _lookups->info(); - const auto values_info = _values->info(); - const auto output_info = _output->info(); - - // NOTE The first dimension's position is always at the end of dimensions. - const auto first_dim_pos = values_info->num_dimensions() - 1; - - const size_t first_dim = values_info->dimension(first_dim_pos); - for (size_t i = 0; i < lookups_info->dimension(0); ++i) - { - if (lookups_buf[i] < 0 || (uint32_t)lookups_buf[i] >= first_dim) - throw std::runtime_error("Embedding Lookup: index out of bounds."); - } - - // If each strides of values and output are different, applied padding size of the two tensors are - // different, therefore, it can not be copied at once. - auto can_copy_at_once = [&]() -> bool { - const auto &values_strides = values_info->strides_in_bytes(); - - for (size_t i = 0; i < first_dim_pos; ++i) - { - if (values_strides[i] != values_strides[i]) - return false; - } - - return true; - }; - - using arm_compute::Window; - using arm_compute::Iterator; - - size_t copy_bytes; - Window window; - if (can_copy_at_once()) - { - copy_bytes = values_info->total_size() / first_dim; - window.use_tensor_dimensions(output_info->tensor_shape(), first_dim_pos); - } - else - { - copy_bytes = values_info->dimension(0) * values_info->element_size(); - window.use_tensor_dimensions(output_info->tensor_shape(), Window::DimY); - } - - Iterator it(_output, window); - execute_window_loop(window, - [&](const arm_compute::Coordinates &id) { - arm_compute::Coordinates values_id = id; - const int idx = id[first_dim_pos]; - values_id.set(first_dim_pos, lookups_buf[idx]); - memcpy(it.ptr(), _values->ptr_to_element(values_id), copy_bytes); - }, - it); - - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_lookups)->unmap(q); - CAST_CL(_values)->unmap(q); - CAST_CL(_output)->unmap(q); - } -} - -} // namespace misc -} // namespace arm_compute diff --git a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleHashtableLookupLayer.cpp b/libs/ARMComputeEx/src/runtime/misc/functions/SimpleHashtableLookupLayer.cpp deleted file mode 100644 index c51af87..0000000 --- a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleHashtableLookupLayer.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include "arm_compute/runtime/misc/functions/SimpleHashtableLookupLayer.h" - -namespace arm_compute -{ -namespace misc -{ - -void SimpleHashtableLookupLayer::configure(arm_compute::ITensor *lookups, - arm_compute::ITensor *keys, arm_compute::ITensor *values, - arm_compute::ITensor *output, arm_compute::ITensor *hits) -{ - _lookups = lookups; - _keys = keys; - _values = values; - _output = output; - _hits = hits; - _lookup_indices.resize(lookups->info()->dimension(0), -1); -} - -void SimpleHashtableLookupLayer::run() -{ - auto &queue = arm_compute::CLScheduler::get().queue(); - if (utils::isGpuMode()) - { - CAST_CL(_lookups)->map(queue); - CAST_CL(_keys)->map(queue); - CAST_CL(_values)->map(queue); - CAST_CL(_output)->map(queue); - CAST_CL(_hits)->map(queue); - } - - const int32_t *lookups_buf = reinterpret_cast(_lookups->buffer()); - const int32_t *keys_buf = reinterpret_cast(_keys->buffer()); - uint8_t *hits_buf = reinterpret_cast(_hits->buffer()); - - const auto lookups_info = _lookups->info(); - const auto values_info = _values->info(); - const auto keys_info = _keys->info(); - const auto output_info = _output->info(); - - // NOTE The first dimension's position must be always at the end of dimensions. - const auto first_dim_pos = values_info->num_dimensions() - 1; - const size_t first_dim = values_info->dimension(first_dim_pos); - - std::map key_map; - const int keys_num = keys_info->dimension(0); - for (int key_index = 0; key_index < keys_num; key_index++) - { - key_map[keys_buf[key_index]] = key_index; - } - - const int lookups_num = lookups_info->dimension(0); - for (int i = 0; i < lookups_num; ++i) - { - const auto lookup_value = lookups_buf[i]; - const auto it = key_map.find(lookup_value); - if (it != key_map.end()) - { - if (it->second >= first_dim) - throw std::runtime_error("HashTable Lookup: index out of bounds."); - _lookup_indices[i] = it->second; - } - } - - // If each strides of values and output are different, applied padding size of the two tensors are - // different, therefore, it can not be copied at once. - auto can_copy_at_once = [&]() -> bool { - const auto &values_strides = values_info->strides_in_bytes(); - - for (size_t i = 0; i < first_dim_pos; ++i) - { - if (values_strides[i] != values_strides[i]) - return false; - } - - return true; - }; - - using arm_compute::Window; - using arm_compute::Iterator; - using arm_compute::Coordinates; - - size_t copy_bytes; - Window window; - if (can_copy_at_once()) - { - copy_bytes = values_info->total_size() / first_dim; - window.use_tensor_dimensions(output_info->tensor_shape(), first_dim_pos); - } - else - { - copy_bytes = values_info->dimension(0) * values_info->element_size(); - window.use_tensor_dimensions(output_info->tensor_shape(), Window::DimY); - } - - Iterator it(_output, window); - execute_window_loop(window, - [&](const Coordinates &id) { - Coordinates values_id = id; - const int idx = id[first_dim_pos]; - const int lookup_index = _lookup_indices[idx]; - if (lookup_index >= 0) - { - values_id.set(first_dim_pos, lookup_index); - memcpy(it.ptr(), _values->ptr_to_element(values_id), copy_bytes); - hits_buf[lookup_index] = 1; - } - else - { - memset(it.ptr(), 0, copy_bytes); - hits_buf[lookup_index] = 0; - } - }, - it); - - if (utils::isGpuMode()) - { - CAST_CL(_lookups)->unmap(queue); - CAST_CL(_keys)->unmap(queue); - CAST_CL(_values)->unmap(queue); - CAST_CL(_output)->unmap(queue); - CAST_CL(_hits)->unmap(queue); - } -} - -} // namespace misc -} // namespace arm_compute diff --git a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleNeg.cpp b/libs/ARMComputeEx/src/runtime/misc/functions/SimpleNeg.cpp deleted file mode 100644 index f46ba15..0000000 --- a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleNeg.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include "arm_compute/runtime/misc/functions/SimpleNeg.h" - -namespace arm_compute -{ -namespace misc -{ - -void SimpleNeg::configure(arm_compute::ITensor *input, arm_compute::ITensor *output) -{ - _input = input; - _output = output; -} - -void SimpleNeg::run() -{ - auto &queue = arm_compute::CLScheduler::get().queue(); - if (utils::isGpuMode()) - { - CAST_CL(_input)->map(queue); - CAST_CL(_output)->map(queue); - } - - arm_compute::Window window; - window.use_tensor_dimensions(_output->info()->tensor_shape()); - - execute_window_loop(window, [this](const arm_compute::Coordinates &id) { - // NOTE Must be two input tensors of identical type - // Must be output tensor of the same type as input0. - assert(_input->info()->data_type() == _output->info()->data_type()); - - switch (_input->info()->data_type()) - { - case arm_compute::DataType::F32: - { - const auto input_value = *reinterpret_cast(_input->ptr_to_element(id)); - *reinterpret_cast(_output->ptr_to_element(id)) = -input_value; - break; - } - case arm_compute::DataType::S32: - { - const auto input_value = *reinterpret_cast(_input->ptr_to_element(id)); - *reinterpret_cast(_output->ptr_to_element(id)) = -input_value; - break; - } - case arm_compute::DataType::U32: - { - const auto input_value = *reinterpret_cast(_input->ptr_to_element(id)); - *reinterpret_cast(_output->ptr_to_element(id)) = -input_value; - break; - } - default: - throw std::runtime_error("Not supported, yet"); - break; - } - }); - - if (utils::isGpuMode()) - { - CAST_CL(_input)->unmap(queue); - CAST_CL(_output)->unmap(queue); - } -} - -} // namespace misc -} // namespace arm_compute diff --git a/libs/ARMComputeEx/src/runtime/misc/functions/SimplePadLayer.cpp b/libs/ARMComputeEx/src/runtime/misc/functions/SimplePadLayer.cpp deleted file mode 100644 index 72affc9..0000000 --- a/libs/ARMComputeEx/src/runtime/misc/functions/SimplePadLayer.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include "arm_compute/runtime/misc/functions/SimplePadLayer.h" - -namespace -{ -bool validate_arg(const arm_compute::ITensor *input, const arm_compute::ITensor *output, - const arm_compute::ITensor *padding_size) -{ - const int input_batch = input->info()->tensor_shape()[3]; - const int input_height = input->info()->tensor_shape()[1]; - const int input_width = input->info()->tensor_shape()[0]; - const int input_depth = input->info()->tensor_shape()[2]; - - const int output_batch = output->info()->tensor_shape()[3]; - const int output_height = output->info()->tensor_shape()[1]; - const int output_width = output->info()->tensor_shape()[0]; - const int output_depth = output->info()->tensor_shape()[2]; - - auto pad_batch_up = *reinterpret_cast(padding_size->ptr_to_element({0, 3})); - auto pad_batch_down = *reinterpret_cast(padding_size->ptr_to_element({1, 3})); - auto pad_height_top = *reinterpret_cast(padding_size->ptr_to_element({0, 1})); - auto pad_height_bottom = *reinterpret_cast(padding_size->ptr_to_element({1, 1})); - auto pad_width_left = *reinterpret_cast(padding_size->ptr_to_element({0, 0})); - auto pad_width_right = *reinterpret_cast(padding_size->ptr_to_element({1, 0})); - auto pad_depth_front = *reinterpret_cast(padding_size->ptr_to_element({0, 2})); - auto pad_depth_back = *reinterpret_cast(padding_size->ptr_to_element({1, 2})); - - const int padded_batch = input_batch + pad_batch_up + pad_batch_down; - const int padded_height = input_height + pad_height_top + pad_height_bottom; - const int padded_width = input_width + pad_width_left + pad_width_right; - const int padded_depth = input_depth + pad_depth_front + pad_depth_back; - - return (padded_batch == output_batch) && (padded_height == output_height) && - (padded_width == output_width) && (padded_depth == output_depth); -} -} // namespace - -namespace arm_compute -{ -namespace misc -{ - -void SimplePadLayer::configure(arm_compute::ITensor *input, arm_compute::ITensor *output, - arm_compute::ITensor *padding_size) -{ -#if defined(ARM_COMPUTE_DEBUG_ENABLED) - const auto rank = padding_size->info()->tensor_shape()[1]; - assert(rank == 4); -#endif - assert(input != nullptr && output != nullptr && padding_size != nullptr); - - _input = input; - _output = output; - _padding_size = padding_size; -} - -template -inline void -ApplyPadding(const arm_compute::ITensor *input_data, const arm_compute::TensorShape &input_shape, - const arm_compute::ITensor *padding_size, arm_compute::ITensor *output_data, - const arm_compute::TensorShape &output_shape, T zero_value) -{ - - assert(validate_arg(input_data, output_data, padding_size) && - "Padded Input shape does not match to output shape"); - - const int input_batch = input_shape[3]; - const int input_height = input_shape[1]; - const int input_width = input_shape[0]; - const int input_depth = input_shape[2]; - - const int output_batch = output_shape[3]; - const int output_height = output_shape[1]; - const int output_width = output_shape[0]; - const int output_depth = output_shape[2]; - - // Padding size for Up, Top, Left and Front are required. - auto pad_batch_up = *reinterpret_cast(padding_size->ptr_to_element({0, 3})); - auto pad_height_top = *reinterpret_cast(padding_size->ptr_to_element({0, 1})); - auto pad_width_left = *reinterpret_cast(padding_size->ptr_to_element({0, 0})); - auto pad_depth_front = *reinterpret_cast(padding_size->ptr_to_element({0, 2})); - - for (int out_b = 0; out_b < output_batch; ++out_b) - { - for (int out_h = 0; out_h < output_height; ++out_h) - { - for (int out_w = 0; out_w < output_width; ++out_w) - { - for (int out_d = 0; out_d < output_depth; ++out_d) - { - const ::arm_compute::Coordinates output_id{out_w, out_h, out_d, out_b}; - - if (out_b < pad_batch_up || out_b >= (input_batch + pad_batch_up) || - out_h < pad_height_top || out_h >= (input_height + pad_height_top) || - out_w < pad_width_left || out_w >= (input_width + pad_width_left) || - out_d < pad_depth_front || out_d >= (input_depth + pad_depth_front)) - { - *reinterpret_cast(output_data->ptr_to_element(output_id)) = zero_value; - } - else - { - const ::arm_compute::Coordinates input_id{ - out_w - pad_width_left, out_h - pad_height_top, out_d - pad_depth_front, - out_b - pad_batch_up}; - *reinterpret_cast(output_data->ptr_to_element(output_id)) = - *reinterpret_cast(input_data->ptr_to_element(input_id)); - } - } - } - } - } -} -void SimplePadLayer::run() -{ - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_input)->map(q); - CAST_CL(_output)->map(q); - CAST_CL(_padding_size)->map(q); - } - - switch (_input->info()->data_type()) - { - case arm_compute::DataType::U8: - case arm_compute::DataType::QASYMM8: - ApplyPadding(_input, _input->info()->tensor_shape(), _padding_size, _output, - _output->info()->tensor_shape(), - _input->info()->quantization_info().offset); - break; - case arm_compute::DataType::F32: - ApplyPadding(_input, _input->info()->tensor_shape(), _padding_size, _output, - _output->info()->tensor_shape(), 0.0f); - break; - default: - ARM_COMPUTE_ERROR("DataType not supported"); - break; - } - - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_input)->unmap(q); - CAST_CL(_output)->unmap(q); - CAST_CL(_padding_size)->unmap(q); - } -} - -} // namespace misc -} // namespace arm_compute diff --git a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleSQRT.cpp b/libs/ARMComputeEx/src/runtime/misc/functions/SimpleSQRT.cpp deleted file mode 100644 index 2d37e98..0000000 --- a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleSQRT.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include "arm_compute/runtime/misc/functions/SimpleSQRT.h" - -namespace arm_compute -{ -namespace misc -{ - -void SimpleSQRT::configure(arm_compute::ITensor *input, arm_compute::ITensor *output) -{ - _input = input; - _output = output; -} - -void SimpleSQRT::run() -{ - auto &queue = arm_compute::CLScheduler::get().queue(); - if (utils::isGpuMode()) - { - CAST_CL(_input)->map(queue); - CAST_CL(_output)->map(queue); - } - - arm_compute::Window window; - window.use_tensor_dimensions(_output->info()->tensor_shape()); - - execute_window_loop(window, [this](const arm_compute::Coordinates &id) { - // NOTE Must be two input tensors of identical type - // Must be output tensor of the same type as input0. - assert(_input->info()->data_type() == _output->info()->data_type()); - - const auto input_value = *reinterpret_cast(_input->ptr_to_element(id)); - *reinterpret_cast(_output->ptr_to_element(id)) = sqrt(input_value); - }); - - if (utils::isGpuMode()) - { - CAST_CL(_input)->unmap(queue); - CAST_CL(_output)->unmap(queue); - } -} - -} // namespace misc -} // namespace arm_compute diff --git a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleSpaceToBatchND.cpp b/libs/ARMComputeEx/src/runtime/misc/functions/SimpleSpaceToBatchND.cpp deleted file mode 100644 index 3cceb0a..0000000 --- a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleSpaceToBatchND.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include "arm_compute/runtime/misc/functions/SimpleSpaceToBatchND.h" - -namespace arm_compute -{ -namespace misc -{ - -void SimpleSpaceToBatchND::configure(arm_compute::ITensor *input, arm_compute::ITensor *block_size, - arm_compute::ITensor *padding_size, - arm_compute::ITensor *output) -{ - assert(input->info()->num_dimensions() == 4); - - _input = input; - _block_size = block_size; - _padding_size = padding_size; - _output = output; -} - -template -inline void -SpaceToBatchND(const arm_compute::ITensor *input, const arm_compute::TensorShape &input_shape, - const arm_compute::ITensor *block_size, const arm_compute::ITensor *padding_size, - const arm_compute::ITensor *output, const arm_compute::TensorShape &output_shape, - T zero_value) -{ - const int input_batch = input_shape[3]; - const int input_height = input_shape[1]; - const int input_width = input_shape[0]; - - const int depth = output_shape[2]; - - const int padding_height_left = *reinterpret_cast(padding_size->ptr_to_element({0, 1})); - const int padding_height_right = *reinterpret_cast(padding_size->ptr_to_element({1, 1})); - const int padding_width_left = *reinterpret_cast(padding_size->ptr_to_element({0, 0})); - const int padding_width_right = *reinterpret_cast(padding_size->ptr_to_element({1, 0})); - const int padded_height = input_height + padding_height_left + padding_height_right; - const int padded_width = input_width + padding_width_left + padding_width_right; - - const int block_size_height = *reinterpret_cast(block_size->ptr_to_element({1})); - const int block_size_width = *reinterpret_cast(block_size->ptr_to_element({0})); - - assert(padding_height_left >= 0); - assert(padding_height_right >= 0); - assert(padding_width_left >= 0); - assert(padding_width_right >= 0); - assert(block_size_height >= 1); - assert(block_size_width >= 1); - assert(padded_height % block_size_height == 0); - assert(padded_width % block_size_width == 0); - assert(output->info()->dimension(3) == - input->info()->dimension(3) * (block_size_height * block_size_width)); - - for (int in_b = 0; in_b < input_batch; ++in_b) - { - for (int in_d = 0; in_d < depth; ++in_d) - { - for (int in_h = 0; in_h < padded_height; ++in_h) - { - for (int in_w = 0; in_w < padded_width; ++in_w) - { - const int out_d = in_d; - const int out_h = in_h / block_size_height; - const int out_w = in_w / block_size_width; - const int out_b = - in_b + - ((in_h % block_size_height) * block_size_width + in_w % block_size_width) * - input_batch; - - const arm_compute::Coordinates output_id{out_w, out_h, out_d, out_b}; - - if (in_h < padding_height_left || in_h >= (input_height + padding_height_left) || - in_w < padding_width_left || in_w >= (input_width + padding_width_left)) - { - *reinterpret_cast(output->ptr_to_element(output_id)) = zero_value; - } - else - { - const arm_compute::Coordinates input_id{in_w - padding_width_left, - in_h - padding_height_left, in_d, in_b}; - *reinterpret_cast(output->ptr_to_element(output_id)) = - *reinterpret_cast(input->ptr_to_element(input_id)); - } - } - } - } - } -} -void SimpleSpaceToBatchND::run() -{ - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_input)->map(q); - CAST_CL(_block_size)->map(q); - CAST_CL(_padding_size)->map(q); - CAST_CL(_output)->map(q); - } - - switch (_input->info()->data_type()) - { - case arm_compute::DataType::U8: - case arm_compute::DataType::QASYMM8: - SpaceToBatchND(_input, _input->info()->tensor_shape(), _block_size, _padding_size, - _output, _output->info()->tensor_shape(), - _input->info()->quantization_info().offset); - break; - case arm_compute::DataType::F32: - SpaceToBatchND(_input, _input->info()->tensor_shape(), _block_size, _padding_size, - _output, _output->info()->tensor_shape(), 0.0f); - break; - default: - ARM_COMPUTE_ERROR("DataType not supported"); - break; - } - - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_input)->unmap(q); - CAST_CL(_block_size)->unmap(q); - CAST_CL(_padding_size)->unmap(q); - CAST_CL(_output)->unmap(q); - } -} - -} // namespace misc -} // namespace arm_compute diff --git a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleSpaceToDepth.cpp b/libs/ARMComputeEx/src/runtime/misc/functions/SimpleSpaceToDepth.cpp deleted file mode 100644 index e6363f7..0000000 --- a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleSpaceToDepth.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include "arm_compute/runtime/misc/functions/SimpleSpaceToDepth.h" - -namespace arm_compute -{ -namespace misc -{ - -void SimpleSpaceToDepth::configure(arm_compute::ITensor *input, arm_compute::ITensor *output, - int32_t block_size, const arm_compute::Coordinates &axises) -{ - const auto rank = axises.num_dimensions(); - assert(rank == 4); - for (uint32_t i = 0; i < rank; ++i) - { - assert(axises[i] >= 0); - assert((uint32_t)axises[i] < rank); - } - - _input = input; - _output = output; - _block_size = block_size; - _axises = axises; -} - -template -inline void SpaceToDepth(const arm_compute::ITensor *input, - const arm_compute::TensorShape &input_shape, int32_t block_size, - arm_compute::ITensor *output, - const arm_compute::TensorShape & /*output_shape*/, - const arm_compute::Coordinates &axises) -{ - const int input_batch = input_shape[axises[0]]; - const int input_height = input_shape[axises[1]]; - const int input_width = input_shape[axises[2]]; - const int input_depth = input_shape[axises[3]]; - - for (int in_b = 0; in_b < input_batch; ++in_b) - { - for (int in_h = 0; in_h < input_height; ++in_h) - { - for (int in_w = 0; in_w < input_width; ++in_w) - { - for (int in_d = 0; in_d < input_depth; ++in_d) - { - const int out_b = in_b; - const int out_h = in_h / block_size; - const int out_w = in_w / block_size; - const int out_d = - in_d + ((in_h % block_size) * block_size + in_w % block_size) * input_depth; - - auto input_id = utils::asARMComputeCoordinates( - arm_compute::Coordinates{in_b, in_h, in_w, in_d}, axises); - auto output_id = utils::asARMComputeCoordinates( - arm_compute::Coordinates{out_b, out_h, out_w, out_d}, axises); - - *reinterpret_cast(output->ptr_to_element(output_id)) = - *reinterpret_cast(input->ptr_to_element(input_id)); - } - } - } - } -} - -void SimpleSpaceToDepth::run() -{ - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_input)->map(q); - CAST_CL(_output)->map(q); - } - - switch (_input->info()->data_type()) - { - case arm_compute::DataType::U8: - case arm_compute::DataType::QASYMM8: - SpaceToDepth(_input, _input->info()->tensor_shape(), _block_size, _output, - _output->info()->tensor_shape(), _axises); - break; - case arm_compute::DataType::F32: - SpaceToDepth(_input, _input->info()->tensor_shape(), _block_size, _output, - _output->info()->tensor_shape(), _axises); - break; - default: - ARM_COMPUTE_ERROR("DataType not supported"); - break; - } - - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_input)->unmap(q); - CAST_CL(_output)->unmap(q); - } -} - -} // namespace misc -} // namespace arm_compute diff --git a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleTransposeConv.cpp b/libs/ARMComputeEx/src/runtime/misc/functions/SimpleTransposeConv.cpp deleted file mode 100644 index a8a6e4d..0000000 --- a/libs/ARMComputeEx/src/runtime/misc/functions/SimpleTransposeConv.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include "arm_compute/runtime/misc/functions/SimpleTransposeConv.h" - -namespace arm_compute -{ -namespace misc -{ - -void SimpleTransposeConv::configure(arm_compute::ITensor *input, arm_compute::ITensor *weights, - arm_compute::ITensor *output, - arm_compute::PadStrideInfo &tconv_info, - arm_compute::Coordinates axises) -{ - assert(axises.num_dimensions() == 4); - - _input = input; - _weights = weights; - _output = output; - _stride_width = tconv_info.stride().first; - _stride_height = tconv_info.stride().second; - _pad_width = tconv_info.pad_left(); - _pad_height = tconv_info.pad_top(); - _axises = axises; -} - -template -inline void ApplyTransposeConv(const arm_compute::TensorShape &input_shape, - const arm_compute::ITensor *input_data, - const arm_compute::TensorShape &filter_shape, - const arm_compute::ITensor *filter_data, - const arm_compute::TensorShape &output_shape, - const arm_compute::ITensor *output_data, const int32_t stride_width, - const int32_t stride_height, const int32_t pad_width, - const int32_t pad_height, const arm_compute::Coordinates axises) -{ - const int batches = input_shape[axises[0]]; - const int input_height = input_shape[axises[1]]; - const int input_width = input_shape[axises[2]]; - const int input_depth = input_shape[axises[3]]; - - const int filter_height = filter_shape[axises[1]]; - const int filter_width = filter_shape[axises[2]]; - - const int output_height = output_shape[axises[1]]; - const int output_width = output_shape[axises[2]]; - const int output_depth = output_shape[axises[3]]; - - assert((size_t)batches == output_shape[axises[0]]); - assert((size_t)input_depth == filter_shape[axises[3]]); - assert(filter_shape[axises[0]] == (size_t)output_depth); - - // Although transpose convolution simplifies to convolution with transposed - // weights for strides of 1, non-unitary striding complicates matters. To - // keep this reference implementation as clear as possible, we use a - // "scatter" access pattern, where we loop through all the input elements, - // computing their influence on the output, rather than looping through the - // output elements in the typical "gather" access pattern of a conv. We - // therefore must initialize the output array to zero. - - // Loop through input elements one at a time. - for (int batch = 0; batch < batches; ++batch) - { - for (int in_y = 0; in_y < input_height; ++in_y) - { - for (int in_x = 0; in_x < input_width; ++in_x) - { - for (int in_channel = 0; in_channel < input_depth; ++in_channel) - { - // Loop through the output elements it will influence - const int out_x_origin = (in_x * stride_width) - pad_width; - const int out_y_origin = (in_y * stride_height) - pad_height; - for (int filter_y = 0; filter_y < filter_height; ++filter_y) - { - for (int filter_x = 0; filter_x < filter_width; ++filter_x) - { - for (int out_channel = 0; out_channel < output_depth; ++out_channel) - { - // Compute output element location - const int out_x = out_x_origin + filter_x; - const int out_y = out_y_origin + filter_y; - // We cannot accumulate out of bounds - if ((out_x >= 0) && (out_x < output_width) && (out_y >= 0) && - (out_y < output_height)) - { - auto input_id = utils::asARMComputeCoordinates( - arm_compute::Coordinates{batch, in_y, in_x, in_channel}, axises); - auto filter_id = utils::asARMComputeCoordinates( - arm_compute::Coordinates{out_channel, filter_y, filter_x, in_channel}, - axises); - auto output_id = utils::asARMComputeCoordinates( - arm_compute::Coordinates{batch, out_y, out_x, out_channel}, axises); - T input_value = *reinterpret_cast(input_data->ptr_to_element(input_id)); - T filter_value = *reinterpret_cast(filter_data->ptr_to_element(filter_id)); - *reinterpret_cast(output_data->ptr_to_element(output_id)) += - input_value * filter_value; - } - } - } - } - } - } - } - } -} - -void SimpleTransposeConv::run() -{ - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_input)->map(q); - CAST_CL(_weights)->map(q); - CAST_CL(_output)->map(q); - } - - switch (_input->info()->data_type()) - { - case arm_compute::DataType::S32: - ApplyTransposeConv(_input->info()->tensor_shape(), _input, - _weights->info()->tensor_shape(), _weights, - _output->info()->tensor_shape(), _output, _stride_width, - _stride_height, _pad_width, _pad_height, _axises); - break; - case arm_compute::DataType::F32: - ApplyTransposeConv(_input->info()->tensor_shape(), _input, - _weights->info()->tensor_shape(), _weights, - _output->info()->tensor_shape(), _output, _stride_width, - _stride_height, _pad_width, _pad_height, _axises); - break; - default: - ARM_COMPUTE_ERROR("DataType not supported"); - break; - } - - if (utils::isGpuMode()) - { - auto &q = arm_compute::CLScheduler::get().queue(); - - CAST_CL(_input)->unmap(q); - CAST_CL(_weights)->unmap(q); - CAST_CL(_output)->unmap(q); - } -} - -} // namespace misc -} // namespace arm_compute diff --git a/runtimes/pure_arm_compute/src/compilation.cc b/runtimes/pure_arm_compute/src/compilation.cc index 172369d..03c2e92 100644 --- a/runtimes/pure_arm_compute/src/compilation.cc +++ b/runtimes/pure_arm_compute/src/compilation.cc @@ -50,22 +50,9 @@ #include "internal/arm_compute/tensor/View.h" #include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include #include -#include -#include #include -#include -#include #include #include "misc/matrix/IndexIterator.h" @@ -599,19 +586,6 @@ void Planner::visit(const ::internal::tflite::op::Add::Node &node) std::unique_ptr<::arm_compute::IFunction> fn; - // NOTE SimpleArithmeticAddition is quite slow, but may be useful for debugging - if (from_env(std::getenv("USE_SIMPLE_ARITHMETIC_ADDITION"))) - { - // NOTE SimpleArithmeticAddition does not support broadcasting - assert(lhs_shape == rhs_shape); - - auto l = nnfw::cpp14::make_unique(); - - l->configure(lhs_alloc, rhs_alloc, ofm_alloc); - - fn = std::move(l); - } - else { if (::internal::arm_compute::isGpuMode()) { @@ -1546,15 +1520,6 @@ void Planner::visit(const ::internal::tflite::op::Dequantize::Node &node) std::unique_ptr<::arm_compute::IFunction> fn; - if (from_env(std::getenv("USE_SIMPLE_CAST"))) - { - // Use the CPU version of CAST operation - auto l = nnfw::cpp14::make_unique(); - - l->configure(input_alloc, output_alloc); - fn = std::move(l); - } - else // Use the OpenCL version of CAST operation { if (::internal::arm_compute::isGpuMode()) { @@ -2851,15 +2816,6 @@ void Planner::visit(const ::internal::tflite::op::Cast::Node &node) std::unique_ptr<::arm_compute::IFunction> fn; - if (from_env(std::getenv("USE_SIMPLE_CAST"))) - { - // Use the CPU version of CAST operation - auto l = nnfw::cpp14::make_unique(); - - l->configure(input_alloc, output_alloc); - fn = std::move(l); - } - else // Use the OpenCL version of CAST operation { if (::internal::arm_compute::isGpuMode()) { @@ -3802,16 +3758,6 @@ void Planner::visit(const ::internal::tflite::op::ArgMax::Node &node) auto ofm_alloc = ctx.at(::internal::tflite::operand::Index{param.ofm_index}); auto ifm_alloc = ctx.at(::internal::tflite::operand::Index{param.ifm_index}); - if (from_env(std::getenv("USE_SIMPLE_ARGOPERATION"))) - { - // USE CPU VERSION OF ARGMAX - auto fn = nnfw::cpp14::make_unique(); - - fn->configure(ifm_alloc, ofm_alloc, param.axis, ::arm_compute::ArgOperation::MAX); - - builder.append("ArgMax", std::move(fn)); - } - else { if (::internal::arm_compute::isGpuMode()) @@ -3866,16 +3812,6 @@ void Planner::visit(const ::internal::tflite::op::SQRT::Node &node) const ::arm_compute::ActivationLayerInfo act_info{ ::arm_compute::ActivationLayerInfo::ActivationFunction::SQRT}; - if (from_env(std::getenv("USE_SIMPLE_SQRT"))) - { - // USE CPU VERSION OF SQRT - auto fn = nnfw::cpp14::make_unique(); - - fn->configure(input_alloc, output_alloc); - - builder.append("SQRT", std::move(fn)); - } - else { if (::internal::arm_compute::isGpuMode()) { @@ -4096,16 +4032,7 @@ void Planner::visit(const ::internal::tflite::op::TransposeConv::Node &node) // Only rank 4 is supported const int rank = 4; - if (from_env(std::getenv("USE_SIMPLE_TRANSPOSECONV"))) - { - auto fn = nnfw::cpp14::make_unique(); - - auto tconv_info = asPadStrideInfo(param.padding, param.stride); - fn->configure(ifm_alloc, ker_alloc, ofm_alloc, tconv_info, getARMComputeAxises(rank)); - - builder.append("TransposeConv", std::move(fn)); - } - else if (::internal::arm_compute::isGpuMode()) + if (::internal::arm_compute::isGpuMode()) { auto fn = nnfw::cpp14::make_unique<::arm_compute::CLDeconvolutionLayerEx>(); @@ -4312,17 +4239,6 @@ void Planner::visit(const ::internal::tflite::op::Pad::Node &node) auto ifm_alloc = ctx.at(::internal::tflite::operand::Index{param.ifm_index}); auto pad_alloc = ctx.at(::internal::tflite::operand::Index{param.padding_index}); - if (from_env(std::getenv("USE_SIMPLE_PAD"))) - { - // USE CPU VERSION OF PADLAYER - auto rank = 4; - auto fn = nnfw::cpp14::make_unique(); - - fn->configure(ifm_alloc, ofm_alloc, pad_alloc); - - builder.append("PAD", std::move(fn)); - } - else { if (::internal::arm_compute::isGpuMode()) // GPU { @@ -4392,17 +4308,6 @@ void Planner::visit(const ::internal::tflite::op::SpaceToDepth::Node &node) auto output_alloc = ctx.at(::internal::tflite::operand::Index{param.output_index}); auto input_alloc = ctx.at(::internal::tflite::operand::Index{param.input_index}); - if (from_env(std::getenv("USE_SIMPLE_SPACETODEPTH"))) - { - // USE CPU VERSION OF SPACETODEPTH - auto rank = 4; - auto fn = nnfw::cpp14::make_unique(); - - fn->configure(input_alloc, output_alloc, param.block_size, getARMComputeAxises(rank)); - - builder.append("SpaceToDepth", std::move(fn)); - } - else { if (::internal::arm_compute::isGpuMode()) // GPU { @@ -4565,15 +4470,7 @@ void Planner::visit(const ::internal::tflite::op::SpaceToBatchND::Node &node) auto block_size_alloc = ctx.at(::internal::tflite::operand::Index{param.block_size_index}); auto padding_size_alloc = ctx.at(::internal::tflite::operand::Index{param.padding_size_index}); - // NOTE SimpleSpaceToBatchND is quite slow - if (from_env(std::getenv("USE_SIMPLE_SPACE_TO_BATCH_ND"))) - { - auto fn = nnfw::cpp14::make_unique(); - - fn->configure(input_alloc, block_size_alloc, padding_size_alloc, output_alloc); - builder.append("SpaceToBatchND", std::move(fn)); - } - else if (::internal::arm_compute::isGpuMode()) + if (::internal::arm_compute::isGpuMode()) { auto fn = nnfw::cpp14::make_unique<::arm_compute::CLSpaceToBatchND>(); @@ -4668,15 +4565,7 @@ void Planner::visit(const ::internal::tflite::op::BatchToSpaceNd::Node &node) auto input_alloc = ctx.at(::internal::tflite::operand::Index{param.input_index}); auto block_size_alloc = ctx.at(::internal::tflite::operand::Index{param.block_size_index}); - // NOTE SimpleBatchToSpaceND is quite slow, but may be useful for debugging - if (from_env(std::getenv("USE_SIMPLE_BATCH_TO_SPACE_ND"))) - { - auto fn = nnfw::cpp14::make_unique(); - - fn->configure(input_alloc, output_alloc, param.block_size, getARMComputeAxises(param.rank)); - builder.append("BatchToSpaceND", std::move(fn)); - } - else if (::internal::arm_compute::isGpuMode()) + if (::internal::arm_compute::isGpuMode()) { auto fn = nnfw::cpp14::make_unique<::arm_compute::CLBatchToSpaceLayer>(); @@ -4970,7 +4859,7 @@ void Planner::visit(const ::internal::tflite::op::EmbeddingLookup::Node &node) const auto &lookups_obj = _ctx.at(lookups_index); const auto &values_obj = _ctx.at(values_index); - // Verify operand here, not at SimpleEmbeddingLookup::configure() to avoid acl's modifying + // Verify operand here, not at configure() to avoid acl's modifying // TensorShape sometimes(Issue: https://github.sec.samsung.net/STAR/nnfw/issues/729) { assert(lookups_obj.type() == ANEURALNETWORKS_TENSOR_INT32); @@ -5022,15 +4911,7 @@ void Planner::visit(const ::internal::tflite::op::EmbeddingLookup::Node &node) auto lookups_alloc = ctx.at(::internal::tflite::operand::Index{param.lookups_index}); auto values_alloc = ctx.at(::internal::tflite::operand::Index{param.values_index}); - if (from_env(std::getenv("USE_SIMPLE_EMBEDDINGLOOKUP"))) - { - auto fn = nnfw::cpp14::make_unique(); - - fn->configure(lookups_alloc, values_alloc, output_alloc); - - builder.append("EmbeddingLookup", std::move(fn)); - } - else if (::internal::arm_compute::isGpuMode()) + if (::internal::arm_compute::isGpuMode()) { auto fn = nnfw::cpp14::make_unique<::arm_compute::CLEmbeddingLookup>(); @@ -5126,15 +5007,7 @@ void Planner::visit(const ::internal::tflite::op::HashtableLookup::Node &node) auto values_alloc = ctx.at(::internal::tflite::operand::Index{param.values_index}); auto keys_alloc = ctx.at(::internal::tflite::operand::Index{param.keys_index}); - if (from_env(std::getenv("USE_SIMPLE_HASHTABLELOOKUP"))) - { - auto fn = nnfw::cpp14::make_unique(); - - fn->configure(lookups_alloc, keys_alloc, values_alloc, output_alloc, hits_alloc); - - builder.append("HashtableLookup", std::move(fn)); - } - else if (::internal::arm_compute::isGpuMode()) // GPU + if (::internal::arm_compute::isGpuMode()) // GPU { auto fn = nnfw::cpp14::make_unique<::arm_compute::CLHashtableLookup>(); @@ -5269,17 +5142,6 @@ void Planner::visit(const ::internal::tflite::op::DepthToSpace::Node &node) auto output_alloc = ctx.at(::internal::tflite::operand::Index{param.output_index}); auto input_alloc = ctx.at(::internal::tflite::operand::Index{param.input_index}); - if (from_env(std::getenv("USE_SIMPLE_DEPTHTOSPACE"))) - { - // USE CPU VERSION OF DEPTHTOSPACE - auto rank = 4; - auto fn = nnfw::cpp14::make_unique(); - - fn->configure(input_alloc, output_alloc, param.block_size, getARMComputeAxises(rank)); - - builder.append("DepthToSpace", std::move(fn)); - } - else { if (::internal::arm_compute::isGpuMode()) // GPU { @@ -5490,15 +5352,7 @@ void Planner::visit(const ::internal::tflite::op::Neg::Node &node) auto ofm_alloc = ctx.at(::internal::tflite::operand::Index{param.ofm_index}); auto ifm_alloc = ctx.at(::internal::tflite::operand::Index{param.ifm_index}); - // NOTE SimpleNeg is quite slow, but may be useful for debugging - if (from_env(std::getenv("USE_SIMPLE_NEG"))) - { - auto fn = nnfw::cpp14::make_unique(); - - fn->configure(ifm_alloc, ofm_alloc); - builder.append("Neg", std::move(fn)); - } - else if (::internal::arm_compute::isGpuMode()) + if (::internal::arm_compute::isGpuMode()) { auto fn = nnfw::cpp14::make_unique<::arm_compute::CLNeg>(); -- 2.7.4