From 05e0ec30a632339a8533082476f27bda31ccde16 Mon Sep 17 00:00:00 2001 From: Chunseok Lee Date: Thu, 30 Jul 2020 11:32:26 +0900 Subject: Imported Upstream version 1.7.0 --- .../arm_compute/runtime/CL/CLFunctionsEx.h | 1 - .../runtime/CL/functions/CLSpaceToBatchND.h | 80 --------------- .../runtime/CPP/functions/CPPOneHotEx.h | 10 +- .../runtime/misc/functions/GenericGather.h | 84 ---------------- .../runtime/misc/functions/GenericReshapeLayer.h | 87 ---------------- .../arm_compute/runtime/misc/functions/Utils.h | 112 --------------------- 6 files changed, 5 insertions(+), 369 deletions(-) delete mode 100644 compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLSpaceToBatchND.h delete mode 100644 compute/ARMComputeEx/arm_compute/runtime/misc/functions/GenericGather.h delete mode 100644 compute/ARMComputeEx/arm_compute/runtime/misc/functions/GenericReshapeLayer.h delete mode 100644 compute/ARMComputeEx/arm_compute/runtime/misc/functions/Utils.h (limited to 'compute/ARMComputeEx/arm_compute/runtime') diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/CLFunctionsEx.h b/compute/ARMComputeEx/arm_compute/runtime/CL/CLFunctionsEx.h index 831bb5423..97bc4cea5 100644 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/CLFunctionsEx.h +++ b/compute/ARMComputeEx/arm_compute/runtime/CL/CLFunctionsEx.h @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLSpaceToBatchND.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLSpaceToBatchND.h deleted file mode 100644 index 09eb69ae5..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLSpaceToBatchND.h +++ /dev/null @@ -1,80 +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. - */ - -/* - * Copyright (c) 2016-2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __ARM_COMPUTE_CLSPACE_TO_BATCH_ND_H__ -#define __ARM_COMPUTE_CLSPACE_TO_BATCH_ND_H__ - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -namespace arm_compute -{ -class ICLTensor; - -/** Basic function to run @ref CLSpaceToBatchNDKernel - * - * @note The tensor data type for the inputs must be U8/QASYMM8/S16/F16/S32/F32. - * @note The function divides "spatial" dimensions of the input into a grid of blocks of shape - * block_shape, and interleaves these blocks with the "batch" dimension such that in the output. - */ -class CLSpaceToBatchND : public ICLSimpleFunction -{ -public: - /** Initialise the kernel's input and output. - * - * @note The data layout of input and output must be the same. - * @note The number of dimensions of input and output must be 4, and `spatial` dimensions - * are height and width. - * @param[in] input Input tensor. Data types supported: U8/QASYMM8/S16/F16/S32/F32. - * Data layout supported: NCHW/NHWC - * @param[in] block_size Tensor of integer values specifying block sizes for spatial - * dimension. - * Data types supported: S32 - * @param[in] padding_size Tensor of integer values specifying padding sizes for spatial - * dimension. - * Data types supported: S32 - * @param[out] output Output tensor. Data types supported: same as @p input. - * Data layout supported: NCHW/NHWC - */ - void configure(const ICLTensor *input, const ICLTensor *block_size, const ICLTensor *padding_size, - ICLTensor *output); -}; - -} // namespace arm_compute -#endif /* __ARM_COMPUTE_CLSPACE_TO_BATCH_ND_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CPP/functions/CPPOneHotEx.h b/compute/ARMComputeEx/arm_compute/runtime/CPP/functions/CPPOneHotEx.h index f132dfcc8..7930e4e20 100644 --- a/compute/ARMComputeEx/arm_compute/runtime/CPP/functions/CPPOneHotEx.h +++ b/compute/ARMComputeEx/arm_compute/runtime/CPP/functions/CPPOneHotEx.h @@ -55,14 +55,14 @@ public: /** Configure the one_hot function * * @param[in] indices A tensor for indices. Data types supported: S32 + * @param[in] depth A tensor for depth. Data types supported: S32 + * @param[in] on_value A tensor for on_value. Data types supported: F32 + * @param[in] off_value A tensor for off_value. Data types supported: F32 * @param[out] output A tensor for computed value of one hot operator - * @param[in] depth An int value for depth - * @param[in] on_value A float value for on_value - * @param[in] off_value A float value for off_value * @param[in] axis An int value for axis */ - void configure(const ITensor *indices, ITensor *output, const int depth, const float on_value, - const float off_value, const int axis); + void configure(const ITensor *indices, const ITensor *depth, const ITensor *on_value, + const ITensor *off_value, ITensor *output, const int axis); }; } #endif /* __ARM_COMPUTE_CPPONEHOT_EX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/misc/functions/GenericGather.h b/compute/ARMComputeEx/arm_compute/runtime/misc/functions/GenericGather.h deleted file mode 100644 index 3db0c7e5e..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/misc/functions/GenericGather.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2019 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        GenericGather.h - * @brief       This file contains GenericGather class - * @ingroup     COM_AI_RUNTIME - */ - -#ifndef __ARM_COMPUTE_MISC_GENERIC_GATHER_H__ -#define __ARM_COMPUTE_MISC_GENERIC_GATHER_H__ - -#include -#include - -#include -#include - -#include "Utils.h" - -namespace arm_compute -{ -namespace misc -{ - -/** - * @brief Class to run Gather with both CPU and GPU - */ -class GenericGather : public arm_compute::IFunction -{ -public: - GenericGather(void) - { - // DO NOTHING - } - -public: - /** - * @brief Configure the layer - * @param[in] input The source tensor - * @param[in] indices The indices tensor - * @param[in] output The destination tensor - * @param[in] axis (Optional) The axis in input to gather indices from - * @return N/A - */ - void configure(arm_compute::ITensor *input, arm_compute::ITensor *indices, - arm_compute::ITensor *output, int axis = 0); - -public: - /** - * @brief Run the operation. Must be called after configure(). - * @return N/A - */ - void run(void) override; - -private: - arm_compute::ITensor *_input{nullptr}; - arm_compute::ITensor *_indices{nullptr}; - arm_compute::ITensor *_output{nullptr}; - int _axis{0}; - arm_compute::CLTensor _cl_permuted; - -private: - arm_compute::CLPermute _cl_permute; - arm_compute::CLGatherEx _cl_gather; -}; - -} // namespace misc -} // namespace arm_compute - -#endif // __ARM_COMPUTE_MISC_GENERIC_GATHER_H__ diff --git a/compute/ARMComputeEx/arm_compute/runtime/misc/functions/GenericReshapeLayer.h b/compute/ARMComputeEx/arm_compute/runtime/misc/functions/GenericReshapeLayer.h deleted file mode 100644 index ab2fdc71d..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/misc/functions/GenericReshapeLayer.h +++ /dev/null @@ -1,87 +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        GenericReshapeLayer.h - * @brief       This file contains GenericReshapeLayer class - * @ingroup     COM_AI_RUNTIME - */ - -#ifndef __ARM_COMPUTE_MISC_GENERIC_RESHAPE_LAYER_H__ -#define __ARM_COMPUTE_MISC_GENERIC_RESHAPE_LAYER_H__ - -#include -#include - -#include -#include -#include -#include - -#include "Utils.h" - -namespace arm_compute -{ -namespace misc -{ - -/** - * @brief Class to run Reshape Layer with both CPU and GPU - */ -class GenericReshapeLayer : public arm_compute::IFunction -{ -public: - GenericReshapeLayer(void) - : _input(nullptr), _output(nullptr), _cl_permuted{}, _neon_permuted{}, _cl_permute{}, - _cl_reshape{}, _neon_permute{}, _neon_reshape{} - { - // DO NOTHING - } - -public: - /** - * @brief Configure the layer - * @param[in] input The source tensor - * @param[in] output The destination tensor - * @return N/A - */ - void configure(const arm_compute::ITensor *input, arm_compute::ITensor *output); - -public: - /** - * @brief Run the operation. Must be called after configure(). - * @return N/A - */ - void run(void) override; - -private: - const arm_compute::ITensor *_input; - arm_compute::ITensor *_output; - arm_compute::CLTensor _cl_permuted; - arm_compute::Tensor _neon_permuted; - -private: - arm_compute::CLPermute _cl_permute; - arm_compute::CLReshapeLayer _cl_reshape; - - arm_compute::NEPermute _neon_permute; - arm_compute::NEReshapeLayer _neon_reshape; -}; - -} // namespace misc -} // namespace arm_compute - -#endif // __ARM_COMPUTE_MISC_GENERIC_RESHAPE_LAYER_H__ diff --git a/compute/ARMComputeEx/arm_compute/runtime/misc/functions/Utils.h b/compute/ARMComputeEx/arm_compute/runtime/misc/functions/Utils.h deleted file mode 100644 index 84ee4ce93..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/misc/functions/Utils.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2019 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 utils.h - * @ingroup COM_AI_RUNTIME - * @brief This file contains utils for arm compute library - */ -#ifndef __ARM_COMPUTE_MISC_UTILS_H__ -#define __ARM_COMPUTE_MISC_UTILS_H__ - -#include -#include -#include - -#include -#include -#include -#include - -// TODO : It should be extracted to independent module. - -namespace arm_compute -{ -namespace misc -{ -namespace utils -{ - -/** - * @brief Check if this runtime runs on GPU or NEON - * @return @c true if GPU mode, otherwise @c false - */ -bool isGpuMode(); - -#ifndef CAST_CL -#define CAST_CL(tensor) static_cast<::arm_compute::CLTensor *>(tensor) -#endif - -#ifndef CAST_NE -#define CAST_NE(tensor) static_cast<::arm_compute::Tensor *>(tensor) -#endif - -/** -* @brief Generate arm compute permutation vector from runtime permutation vector -* @param[in] rank Rank number supported upto 4 -* @param[in] runtime_pv Integer array for runtime permutation vector -* @return Permutation vector of arm compute -*/ -arm_compute::PermutationVector getARMComputePermutationVector(uint32_t rank, - const int32_t *runtime_pv); - -/** - * @brief Set value to arm compute tensor with casting - * @param[in] value Value to set - * @param[out] to Target tensor of arm compute - * @param[in] id Position of element - * @return N/A - */ -template -void copyCast(const FromT value, arm_compute::ITensor *to, const arm_compute::Coordinates &id) -{ - switch (to->info()->data_type()) - { - case arm_compute::DataType::F32: - { - *reinterpret_cast(to->ptr_to_element(id)) = static_cast(value); - break; - } - case arm_compute::DataType::S32: - { - *reinterpret_cast(to->ptr_to_element(id)) = static_cast(value); - break; - } - case arm_compute::DataType::U32: - { - *reinterpret_cast(to->ptr_to_element(id)) = static_cast(value); - break; - } - case arm_compute::DataType::QASYMM8: - { - float realValue = static_cast(value); - // NOTE We haven't known the policy of rounding for quantization. - // So this is set to a temporary value. - *(to->ptr_to_element(id)) = quantize_qasymm8(realValue, to->info()->quantization_info(), - arm_compute::RoundingPolicy::TO_ZERO); - break; - } - default: - throw std::runtime_error("Not supported, yet"); - break; - } -} - -} // namespace utils -} // namespace misc -} // namespace arm_compute - -#endif // __ARM_COMPUTE_MISC_UTILS_H__ -- cgit v1.2.3