diff options
author | Chunseok Lee <chunseok.lee@samsung.com> | 2020-10-29 13:12:50 +0900 |
---|---|---|
committer | Chunseok Lee <chunseok.lee@samsung.com> | 2020-10-29 13:12:50 +0900 |
commit | d6b371e095d737922187a518b8faba1ef6f3a2b1 (patch) | |
tree | 9d90c09c887b5111389dbedf924f59206411cd5a /compute/ARMComputeEx/arm_compute | |
parent | c55f8a6db48cda9d3a78048338b7f18c4cca62b8 (diff) | |
download | nnfw-d6b371e095d737922187a518b8faba1ef6f3a2b1.tar.gz nnfw-d6b371e095d737922187a518b8faba1ef6f3a2b1.tar.bz2 nnfw-d6b371e095d737922187a518b8faba1ef6f3a2b1.zip |
Imported Upstream version 0.4upstream/0.4
Diffstat (limited to 'compute/ARMComputeEx/arm_compute')
64 files changed, 0 insertions, 7919 deletions
diff --git a/compute/ARMComputeEx/arm_compute/core/CL/CLKernelLibraryEx.h b/compute/ARMComputeEx/arm_compute/core/CL/CLKernelLibraryEx.h deleted file mode 100644 index d29886a9d..000000000 --- a/compute/ARMComputeEx/arm_compute/core/CL/CLKernelLibraryEx.h +++ /dev/null @@ -1,268 +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. - */ - -/** - * @file CLKernelLibraryEx.h - * @ingroup COM_AI_RUNTIME - * @brief This file is a cloned version of CLKernelLibrary.h in ACL. This file defines - * an interface for CLKernelLibrary.cpp which adds more OpenCL kernels on top of ACL. - */ - -#ifndef __ARM_COMPUTE_CLKERNELLIBRARY_EX_H__ -#define __ARM_COMPUTE_CLKERNELLIBRARY_EX_H__ - -#include "arm_compute/core/CL/OpenCL.h" - -#include <map> -#include <set> -#include <string> -#include <utility> - -namespace arm_compute -{ - -/** - * @brief Class to build OpenCL kernels added from nnfw - * */ -class CLKernelLibraryEx -{ - using StringSet = std::set<std::string>; - -private: - /** - * @brief Construct a new CLKernelLibraryEx object - */ - CLKernelLibraryEx(); - -public: - /** - * @brief Prevent instances of this class from being copied. - */ - CLKernelLibraryEx(const CLKernelLibraryEx &) = delete; - - /** - * @brief Prevent instances of this class from being copied. - */ - const CLKernelLibraryEx &operator=(const CLKernelLibraryEx &) = delete; - - /** - * @brief Get the KernelLibrary singleton. - * @return The KernelLibrary instance - */ - static CLKernelLibraryEx &get(); - - /** - * @brief Initialise the kernel library. - * @param[in] kernel_path Path of the directory from which kernel sources are loaded. - * @param[in] context CL context used to create programs. - * @param[in] device CL device for which the programs are created. - * @return N/A - */ - void init(std::string kernel_path, cl::Context context, cl::Device device) - { - _kernel_path = std::move(kernel_path); - _context = std::move(context); - _device = std::move(device); - } - - /** - * @brief Set the path that the kernels reside in. - * @param[in] kernel_path Path of the directory from which kernel sources are loaded. - * @return N/A - */ - void set_kernel_path(const std::string &kernel_path) { _kernel_path = kernel_path; }; - - /** - * @brief Get the path that the kernels reside in. - * @return the path of kernel files - */ - std::string get_kernel_path() { return _kernel_path; }; - - /** - * @brief Get the source of the selected program. - * @param[in] program_name Program name. - * @return Source of the selected program. - */ - std::string get_program_source(const std::string &program_name); - - /** - * @brief Set the CL context used to create programs. - * @note Setting the context also resets the device to the - * first one available in the new context. - * @param[in] context A CL context. - * @return N/A - */ - void set_context(cl::Context context) - { - _context = std::move(context); - if (_context.get() == nullptr) - { - _device = cl::Device(); - } - else - { - const auto cl_devices = _context.getInfo<CL_CONTEXT_DEVICES>(); - - if (cl_devices.empty()) - { - _device = cl::Device(); - } - else - { - _device = cl_devices[0]; - } - } - } - - /** - * @brief Return associated CL context. - * @return A CL context. - */ - cl::Context &context() { return _context; } - - /** - * @brief Set the CL device for which the programs are created. - * @param[in] device A CL device. - * @return N/A - */ - void set_device(cl::Device device) { _device = std::move(device); } - - /** - * @brief Gets the CL device for which the programs are created. - * @return A CL device. - */ - cl::Device &get_device() { return _device; } - - /** - * @brief Return the device version - * @return The content of CL_DEVICE_VERSION - */ - std::string get_device_version(); - - /** - * @brief Create a kernel from the kernel library. - * @param[in] kernel_name Kernel name. - * @param[in] build_options_set Kernel build options as a set. - * @return The created kernel. - */ - Kernel create_kernel(const std::string &kernel_name, - const StringSet &build_options_set = {}) const; - - /** - * @brief Find the maximum number of local work items in a workgroup can be supported for the - * kernel. - * @param[in] kernel kernel object - */ - - size_t max_local_workgroup_size(const cl::Kernel &kernel) const; - /** - * @brief Return the default NDRange for the device. - * @return default NDRangeof the device - */ - cl::NDRange default_ndrange() const; - - /** - * @brief Clear the library's cache of binary programs - * @return N/A - */ - void clear_programs_cache() - { - _programs_map.clear(); - _built_programs_map.clear(); - } - - /** - * @brief Access the cache of built OpenCL programs - * @return program map data structure of which key is name of kernel and value is - * kerel source name. (*.cl) - */ - const std::map<std::string, cl::Program> &get_built_programs() const - { - return _built_programs_map; - } - - /** - * @brief Add a new built program to the cache - * @param[in] built_program_name Name of the program - * @param[in] program Built program to add to the cache - * @return N/A - */ - void add_built_program(const std::string &built_program_name, cl::Program program); - - /** - * @brief Returns true if FP16 is supported by the CL device - * @return true if the CL device supports FP16 - */ - bool fp16_supported() const; - - /** - * @brief Returns true if int64_base_atomics extension is supported by the CL device - * @return true if the CL device supports int64_base_atomics extension - */ - bool int64_base_atomics_supported() const; - -private: - /** - * @brief Load program and its dependencies. - * @param[in] program_name Name of the program to load. - */ - const Program &load_program(const std::string &program_name) const; - /** - * @brief Concatenates contents of a set into a single string. - * @param[in] s Input set to concatenate. - * @return Concatenated string. - */ - std::string stringify_set(const StringSet &s) const; - - cl::Context _context; /**< Underlying CL context. */ - cl::Device _device; /**< Underlying CL device. */ - std::string _kernel_path; /**< Path to the kernels folder. */ - mutable std::map<std::string, const Program> - _programs_map; /**< Map with all already loaded program data. */ - mutable std::map<std::string, cl::Program> - _built_programs_map; /**< Map with all already built program data. */ - static const std::map<std::string, std::string> - _kernel_program_map; /**< Map that associates kernel names with programs. */ - static const std::map<std::string, std::string> - _program_source_map; /**< Contains sources for all programs. - Used for compile-time kernel inclusion. >*/ -}; -} -#endif /* __ARM_COMPUTE_CLKERNELLIBRARY_EX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLArgMinMaxLayerKernelEx.h b/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLArgMinMaxLayerKernelEx.h deleted file mode 100644 index a0aa0560b..000000000 --- a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLArgMinMaxLayerKernelEx.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2020 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) 2019-2020 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_CLARGMINMAXLAYERKERNELEX_H -#define ARM_COMPUTE_CLARGMINMAXLAYERKERNELEX_H - -#include "arm_compute/core/CL/ICLKernel.h" -#include "arm_compute/core/Types.h" - -namespace arm_compute -{ -class ICLTensor; - -/** Interface for the reduction operation kernel - * - * @note The default data type for an uninitialized output tensor is - * signed 32-bit integer (S32). It is the user's responsibility to check - * that the results do not overflow because the indices are computed - * in unsigned 32-bit (U32). - */ -class CLArgMinMaxLayerKernelEx : public ICLKernel -{ -public: - /** Default constructor */ - CLArgMinMaxLayerKernelEx(); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLArgMinMaxLayerKernelEx(const CLArgMinMaxLayerKernelEx &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLArgMinMaxLayerKernelEx &operator=(const CLArgMinMaxLayerKernelEx &) = delete; - /** Allow instances of this class to be moved */ - CLArgMinMaxLayerKernelEx(CLArgMinMaxLayerKernelEx &&) = default; - /** Allow instances of this class to be moved */ - CLArgMinMaxLayerKernelEx &operator=(CLArgMinMaxLayerKernelEx &&) = default; - /** Default destructor */ - ~CLArgMinMaxLayerKernelEx() = default; - - /** Set the input and output tensors. - * - * @param[in] input Source tensor. Data types supported: S32/F16/F32. - * @param[in] prev_output Destination tensor of the previous iterations of @ref - * CLArgMinMaxLayerKernelEx. Data types supported: U32/S32 - * Has to be nullptr for the first iteration - * @param[out] output Destination tensor. Data types supported: U32/S32 - * Output will have the same number of dimensions as input. - * @param[in] axis Axis along which to reduce. Supported reduction axis : 0,1,2,3 - * @param[in] op Reduction operation to perform. Only ArgMin and ArgMax are supported. - */ - void configure(const ICLTensor *input, const ICLTensor *prev_output, ICLTensor *output, - unsigned int axis, ReductionOperation op); - - /** Static function to check if given info will lead to a valid configuration of @ref - * CLArgMinMaxLayerKernelEx. - * - * @param[in] input Source tensor info. Data types supported: S32/F16/F32. - * @param[in] prev_output Destination tensor info of the previous iterations. Data types - * supported: U32/S32 - * Has to be nullptr for the first iteration - * @param[in] output Destination tensor info. Data types supported: U32/S32 - * Output will have the same number of dimensions as input. - * @param[in] axis Axis along which to reduce. Supported reduction axis : 0,1,2,3 - * @param[in] op Reduction operation to perform. Only ArgMin and ArgMax are supported. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *prev_output, - const ITensorInfo *output, unsigned int axis, ReductionOperation op); - - // Inherited methods overridden: - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - const ICLTensor *_input; - const ICLTensor *_prev_output; - ICLTensor *_output; - unsigned int _reduction_axis; - ReductionOperation _op; -}; -} // namespace arm_compute -#endif /* ARM_COMPUTE_CLARGMINMAXLAYERKERNELEX_H */ diff --git a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLBinaryLogicalOpKernel.h b/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLBinaryLogicalOpKernel.h deleted file mode 100644 index bb6fcb8f5..000000000 --- a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLBinaryLogicalOpKernel.h +++ /dev/null @@ -1,86 +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_CLBINARYLOGICALOPKERNEL_H__ -#define __ARM_COMPUTE_CLBINARYLOGICALOPKERNEL_H__ - -#include "arm_compute/core/CL/ICLKernel.h" -#include "arm_compute/core/TypesEx.h" - -namespace arm_compute -{ -class ICLTensor; - -/** OpenCL kernel to return truth values of two input tensors for Binary Logical Op*/ -class CLBinaryLogicalOpKernel : public ICLKernel -{ -public: - /** Default constructor */ - CLBinaryLogicalOpKernel(); - /** Prevent instances of this class from being copied (As this class contains pointers). */ - CLBinaryLogicalOpKernel(const CLBinaryLogicalOpKernel &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers). */ - CLBinaryLogicalOpKernel &operator=(const CLBinaryLogicalOpKernel &) = delete; - /** Allow instances of this class to be moved */ - CLBinaryLogicalOpKernel(CLBinaryLogicalOpKernel &&) = default; - /** Allow instances of this class to be moved */ - CLBinaryLogicalOpKernel &operator=(CLBinaryLogicalOpKernel &&) = default; - /** Initialize the kernel's input, output. - * - * @param[in] input1 Source tensor1. - * @param[in] input2 Source tensor2. - * @param[out] output Output tensor. - */ - void configure(const ICLTensor *input1, const ICLTensor *input2, ICLTensor *output, - BinaryLogicalOperation op); - - // Inherited methods overridden: - void run(const Window &window, cl::CommandQueue &queue) override; - - BorderSize border_size() const override; - -private: - const ICLTensor *_input1; - const ICLTensor *_input2; - ICLTensor *_output; -}; - -} // namespace arm_compute -#endif /*__ARM_COMPUTE_CLBINARYLOGICALOPKERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLCastBoolKernel.h b/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLCastBoolKernel.h deleted file mode 100644 index ed668fd9c..000000000 --- a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLCastBoolKernel.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2020 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) 2018-2020 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. - */ - -/** - * @file CLCastBoolKernel.h - * @ingroup COM_AI_RUNTIME - * @brief This file defines CLCastBoolKernel class - */ - -#ifndef __ARM_COMPUTE_CLCASTBOOLKERNEL_H__ -#define __ARM_COMPUTE_CLCASTBOOLKERNEL_H__ - -#include "arm_compute/core/CL/ICLSimple3DKernel.h" - -namespace arm_compute -{ -class ICLTensor; - -/** - * @brief Class for the kernel converting boolean type - */ -class CLCastBoolKernel : public ICLSimple3DKernel -{ -public: - /** - * @brief Initialise the kernel's input and output. - * @param[in] input Input tensor. Data types supported: U8 - * @param[in] output Output tensor. Data types supported: U8/QASYMM8/S16/S32/F16/F32. - * @return N/A - */ - void configure(const ICLTensor *input, ICLTensor *output); - - /** Static function to check if given info will lead to a valid configuration of @ref - * CLCastBoolKernel - * - * @param[in] input Source tensor info. Data types supported: U8. - * @param[in] output Destination tensor info. Data type supported: U8/S8/U16/S16/U32/S32/F16/F32. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output); -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_CLCASTBOOLKERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLEmbeddingLookupKernel.h b/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLEmbeddingLookupKernel.h deleted file mode 100644 index a614d5259..000000000 --- a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLEmbeddingLookupKernel.h +++ /dev/null @@ -1,136 +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. - */ - -/** - * @file CLEmbeddingLookupKernel.h - * @ingroup COM_AI_RUNTIME - * @brief This file defines CLEmbeddingLookupKernel class - */ - -#ifndef __ARM_COMPUTE_CLEMBEDDINGLOOKUPKERNEL_H__ -#define __ARM_COMPUTE_CLEMBEDDINGLOOKUPKERNEL_H__ - -#include "arm_compute/core/CL/ICLKernel.h" - -namespace arm_compute -{ -class ICLTensor; - -/** -* @brief Class to perform EmbeddingLookup operation with opencl kernel -*/ -class CLEmbeddingLookupKernel : public ICLKernel -{ -public: - /** - * @brief Construct a CLEmbeddingLookupKernel object - * */ - CLEmbeddingLookupKernel(); - - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers) - * */ - CLEmbeddingLookupKernel(const CLEmbeddingLookupKernel &) = delete; - - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers) - * */ - CLEmbeddingLookupKernel &operator=(const CLEmbeddingLookupKernel &) = delete; - - /** - * @brief Construct a CLEmbeddingLookupKernel object by using default move constructor - * @param[in] CLEmbeddingLookupKernel object to move - * */ - CLEmbeddingLookupKernel(CLEmbeddingLookupKernel &&) = default; - - /** - * @brief Move assignment operator - * @param[in] CLEmbeddingLookupKernel object to move - * */ - CLEmbeddingLookupKernel &operator=(CLEmbeddingLookupKernel &&) = default; - - /** - * @brief Destruct this object - * */ - ~CLEmbeddingLookupKernel() = default; - - /** - * @brief Set the input and output of the kernel - * @param[in] input Source tensor. - * Data type supported: U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32 - * @param[out] output Destination tensor. Data type supported: Same as @p input - * @param[in] lookups Lookups are 1D tensor that values are indices into the first - * dimension of input. - * Data types supported: S32. - * @return N/A - */ - void configure(const ICLTensor *input, ICLTensor *output, const ICLTensor *lookups); - - /** - * @brief Static function to check if given info will lead to a valid configuration of @ref - * CLEmbeddingLookupKernel - * @param[in] input The input tensor info. - * Data types supported: U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32 - * @param[in] output The output tensor info, Data types supported: same as @p input1. - * @param[in] lookups Lookups info. Data types supported: S32. - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, - const ITensorInfo *lookups); - - /** - * @brief Enqueue the OpenCL kernel to process the given window on the passed OpenCL command - * queue. - * @note The queue is *not* flushed by this method, and therefore the kernel will not have - * been executed by the time this method returns. - * @param[in] window Region on which to execute the kernel. (Must be a valid region of - * the window returned by window()). - * @param[in,out] queue Command queue on which to enqueue the kernel.@return N/A - * @return N/A - */ - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - const ICLTensor *_input; /** Source tensor */ - ICLTensor *_output; /** Destination tensor */ - const ICLTensor *_lookups; /** Lookups tensor */ -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_CLEMBEDDINGLOOKUPKERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLGatherExKernel.h b/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLGatherExKernel.h deleted file mode 100644 index 6630c7be7..000000000 --- a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLGatherExKernel.h +++ /dev/null @@ -1,132 +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. - */ - -/** - * @file CLGatherExKernel.h - * @ingroup COM_AI_RUNTIME - * @brief This file defines CLGatherExKernel class - */ - -#ifndef __ARM_COMPUTE_CLGATHEREXKERNEL_H__ -#define __ARM_COMPUTE_CLGATHEREXKERNEL_H__ - -#include "arm_compute/core/CL/ICLKernel.h" - -namespace arm_compute -{ -class ICLTensor; - -/** - * @brief Class to define an interface for the gather kernel. - */ -class CLGatherExKernel : public ICLKernel -{ -public: - /** - * @brief Construct CLGatherExKernel object - * */ - CLGatherExKernel(); - - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - */ - CLGatherExKernel(const CLGatherExKernel &) = delete; - - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - */ - CLGatherExKernel &operator=(const CLGatherExKernel &) = delete; - - /** - * @brief Construct CLGatherExKernel object by using default move constructor - * @param[in] CLGatherExKernel object to move - */ - CLGatherExKernel(CLGatherExKernel &&) = default; - - /** - * @brief Move assignment operator - * @param[in] CLGatherExKernel object to move - */ - CLGatherExKernel &operator=(CLGatherExKernel &&) = default; - - /** - * @brief Initialise the kernel's input, output and border mode. - * @param[in] input An input tensor. Data types supported: U8/QASYMM8/S32/F32. - * @param[in] indices Indices tensor. Data types supported: S32. - * @param[out] output The output tensor, Data types supported: same as @p input1. - * @param[in] axis (Optional) The axis in @p input to gather @p indices from. Negative - * values wrap around. Defaults to 0 - * @return N/A - */ - void configure(const ICLTensor *input, const ICLTensor *indices, ICLTensor *output, int axis = 0); - - /** - * @brief Static function to check if given info will lead to a valid configuration of @ref - * CLGatherExKernel - * @param[in] input An input tensor. Data types supported: U8/QASYMM8/S32/F32. - * @param[in] indices Indices tensor. Data types supported: S32. - * @param[out] output The output tensor, Data types supported: same as @p input1. - * @param[in] axis (Optional) The axis in @p input to gather @p indices from. Negative - * values wrap around. Defaults to 0 - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *indices, - const ITensorInfo *output, int axis = 0); - - /** - * @brief Enqueue the OpenCL kernel to process the given window on the passed OpenCL command - * queue. - * @note The queue is *not* flushed by this method, and therefore the kernel will not have - * been executed by the time this method returns. - * @param[in] window Region on which to execute the kernel. (Must be a valid region of - * the window returned by window()). - * @param[in,out] queue Command queue on which to enqueue the kernel.@return N/A - * @return N/A - */ - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - const ICLTensor *_input; - const ICLTensor *_indices; - ICLTensor *_output; - int _axis; -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_CLGATHEREXKERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLHashtableLookupKernel.h b/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLHashtableLookupKernel.h deleted file mode 100644 index 99cfa61ec..000000000 --- a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLHashtableLookupKernel.h +++ /dev/null @@ -1,152 +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. - */ - -/** - * @file CLHashtableLookupKernel.h - * @ingroup COM_AI_RUNTIME - * @brief This file defines CLHashtableLookupKernel class - */ - -#ifndef __ARM_COMPUTE_CLHASHTABLELOOKUPKERNEL_H__ -#define __ARM_COMPUTE_CLHASHTABLELOOKUPKERNEL_H__ - -#include "arm_compute/core/CL/ICLKernel.h" -#include "arm_compute/runtime/CL/CLTensor.h" - -namespace arm_compute -{ -class ICLTensor; - -/** -* @brief Class to perform HashtableLookup operation with opencl kernel -*/ -class CLHashtableLookupKernel : public ICLKernel -{ -public: - /** - * @brief Construct a CLHashtableLookupKernel object - * */ - CLHashtableLookupKernel(); - - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers) - * */ - CLHashtableLookupKernel(const CLHashtableLookupKernel &) = delete; - - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers) - * */ - CLHashtableLookupKernel &operator=(const CLHashtableLookupKernel &) = delete; - - /** - * @brief Construct a CLHashtableLookupKernel object by using default move constructor - * @param[in] CLHashtableLookupKernel object to move - * */ - CLHashtableLookupKernel(CLHashtableLookupKernel &&) = default; - - /** - * @brief Move assignment operator - * @param[in] CLHashtableLookupKernel object to move - * */ - CLHashtableLookupKernel &operator=(CLHashtableLookupKernel &&) = default; - - /** - * @brief Destruct this object - * */ - ~CLHashtableLookupKernel() = default; - - /** - * @brief Set the input and output of the kernel - * @param[in] lookups Lookups 1D tensor that values are indices into the first dimension of - * input. - * @param[in] keys Keys 1D tensor. keys and input pair represent a map. - * Data types supported: S32 - * @param[in] input Source tensor. - * Data types supported: U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32 - * @param[out] output Destination tensor. Data types and data layouts supported: Same as @p - * input. - * @param[out] hits Hits 1D tensor. A boolean tensor that indicates whether the lookup hits - * (True) or not (False). Data types supported: U8/QASYMM8 - * @return N/A - */ - void configure(const ICLTensor *lookups, const ICLTensor *keys, const ICLTensor *input, - ICLTensor *output, ICLTensor *hits); - - /** - * @brief Static function to check if given info will lead to a valid configuration of @ref - * CLHashtableLookupKernel - * @param[in] lookups The lookups tensor info. Data types supported: S32. - * @param[in] keys The keys tensor info. keys and input pair represent a map. - * Data types supported: S32 - * @param[in] input The input tensor info. - * Data types supported: U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32 - * @param[out] output The output tensor. Data types and data layouts supported: Same as @p - * input. - * @param[out] hits The hits tensor info. A boolean tensor that indicates whether the lookup - * hits - * (True) or not (False). Data types supported: U8/QASYMM8 - * @return a status - */ - static Status validate(const ITensorInfo *lookups, const ITensorInfo *keys, - const ITensorInfo *input, const ITensorInfo *output, - const ITensorInfo *hits); - - /** - * @brief Enqueue the OpenCL kernel to process the given window on the passed OpenCL command - * queue. - * @note The queue is *not* flushed by this method, and therefore the kernel will not have - * been executed by the time this method returns. - * @param[in] window Region on which to execute the kernel. (Must be a valid region of - * the window returned by window()). - * @param[in,out] queue Command queue on which to enqueue the kernel.@return N/A - * @return N/A - */ - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - const ICLTensor *_lookups{nullptr}; /** Lookups tensor */ - const ICLTensor *_keys{nullptr}; /** Keys tensor */ - const ICLTensor *_input{nullptr}; /** Source tensor */ - ICLTensor *_output{nullptr}; /** Destination tensor */ - ICLTensor *_hits{nullptr}; /** Hits tensor */ - std::unique_ptr<CLTensor> _lookup_indices{nullptr}; /** Lookup indices tensor */ -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_CLHASHTABLELOOKUPKERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLInstanceNormalizationLayerKernelEx.h b/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLInstanceNormalizationLayerKernelEx.h deleted file mode 100644 index f57e799ad..000000000 --- a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLInstanceNormalizationLayerKernelEx.h +++ /dev/null @@ -1,116 +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. - */ - -/* - * Copyright (c) 2019 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_CLINSTANCENORMALIZATIONLAYERKERNELEX_H__ -#define __ARM_COMPUTE_CLINSTANCENORMALIZATIONLAYERKERNELEX_H__ - -#include "arm_compute/core/CL/ICLKernel.h" - -namespace arm_compute -{ -class ICLTensor; - -/** Interface for performing an instance normalization */ -class CLInstanceNormalizationLayerKernelEx : public ICLKernel -{ -public: - /** Constructor */ - CLInstanceNormalizationLayerKernelEx(); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLInstanceNormalizationLayerKernelEx(const CLInstanceNormalizationLayerKernelEx &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLInstanceNormalizationLayerKernelEx & - operator=(const CLInstanceNormalizationLayerKernelEx &) = delete; - /** Default Move Constructor. */ - CLInstanceNormalizationLayerKernelEx(CLInstanceNormalizationLayerKernelEx &&) = default; - /** Default move assignment operator */ - CLInstanceNormalizationLayerKernelEx & - operator=(CLInstanceNormalizationLayerKernelEx &&) = default; - /** Default destructor */ - ~CLInstanceNormalizationLayerKernelEx() = default; - - /** Set the input and output tensors. - * - * @param[in, out] input Source tensor. Data types supported: F16/F32. Data layout supported: - * NCHW - * @param[out] output Destination tensor. Data types and data layouts supported: same as @p - * input. - * @param[in] gamma (Optional) The scale tensor applied to the normalized tensor. Defaults - * to nullptr - * @param[in] beta (Optional) The offset tensor applied to the normalized tensor. Defaults - * to nullptr - * @param[in] epsilon (Optional) Lower bound value for the normalization. Defaults to 1e-12 - */ - void configure(ICLTensor *input, ICLTensor *output, ICLTensor *gamma = nullptr, - ICLTensor *beta = nullptr, float epsilon = 1e-12f); - - /** Static function to check if given info will lead to a valid configuration of @ref - * CLInstanceNormalizationLayerEx. - * - * @param[in] input Source tensor info. In case of @p output tensor = nullptr this tensor will - * store the result of the normalization. - * Data types supported: F16/F32. Data layout supported: NHWC, NCHW - * @param[in] output Destination tensor info. Data types and data layouts supported: same as @p - * input. - * @param[in] gamma (Optional) The scale tensor applied to the normalized tensor. Defaults to - * nullptr - * @param[in] beta (Optional) The offset tensor applied to the normalized tensor. Defaults to - * nullptr - * @param[in] epsilon (Optional) Lower bound value for the normalization. Defaults to 1e-12 - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, - const ITensorInfo *gamma = nullptr, const ITensorInfo *beta = nullptr, - float epsilon = 1e-12f); - - // Inherited methods overridden: - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - ICLTensor *_input; - ICLTensor *_output; - ICLTensor *_gamma; - ICLTensor *_beta; - float _epsilon; - bool _run_in_place; -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_CLINSTANCENORMALIZATIONLAYERKERNELEX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLMultiplyScaleFactorKernel.h b/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLMultiplyScaleFactorKernel.h deleted file mode 100644 index 90e8b5705..000000000 --- a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLMultiplyScaleFactorKernel.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2020 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) 2017-2019 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_CLMULTIPLYSCALEFACTORKERNEL_H__ -#define __ARM_COMPUTE_CLMULTIPLYSCALEFACTORKERNEL_H__ - -#include "arm_compute/core/CL/ICLKernel.h" - -namespace arm_compute -{ -class ITensor; - -/** Interface to multiply scale factor kernel. */ -class CLMultiplyScaleFactorKernel : public ICLKernel -{ -public: - /** Default constructor */ - CLMultiplyScaleFactorKernel(); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLMultiplyScaleFactorKernel(const CLMultiplyScaleFactorKernel &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLMultiplyScaleFactorKernel &operator=(const CLMultiplyScaleFactorKernel &) = delete; - /** Default Move Constructor. */ - CLMultiplyScaleFactorKernel(CLMultiplyScaleFactorKernel &&) = default; - /** Default move assignment operator */ - CLMultiplyScaleFactorKernel &operator=(CLMultiplyScaleFactorKernel &&) = default; - /** Default destructor */ - ~CLMultiplyScaleFactorKernel() = default; - /** Set input, output tensors. - * - * @param[in/out] input Source tensor. Data type supported: S32. - * @param[in] scale_factor Scale tensor. Data type supported: F16/F32. - * @param[out] output Destination tensor. Data type supported: Same as @p scale_factor. - * @param[in] multiplier Additional scale value. - */ - void configure(const ICLTensor *input, const ICLTensor *scale_factor, ICLTensor *output, - float multiplier = 1.f); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLMultiplyScaleFactorKernel - * - * @param[in] input Input tensor info. Data types supported: S32. - * @param[in] scale_factor Scale tensor. Data type supported: F16/F32. - * @param[in] output Output tensor info. Data types supported: Same as @p scale_factor. - * @param[in] multiplier Additional scale value. - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *scale_factor, - const ITensorInfo *output); - - /** - * @brief Enqueue the OpenCL kernel to process the given window on the passed OpenCL command - * queue. - * @note The queue is *not* flushed by this method, and therefore the kernel will not have - * been executed by the time this method returns. - * @param[in] window Region on which to execute the kernel. (Must be a valid region of - * the window returned by window()). - * @param[in,out] queue Command queue on which to enqueue the kernel.@return N/A - * @return N/A - */ - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - const ICLTensor *_input; - const ICLTensor *_scale_factor; - ICLTensor *_output; - float _multiplier; -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_CLMULTIPLYSCALEFACTORKERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLNegKernel.h b/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLNegKernel.h deleted file mode 100644 index fa383c0d0..000000000 --- a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLNegKernel.h +++ /dev/null @@ -1,79 +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_CLNEGKERNEL_H__ -#define __ARM_COMPUTE_CLNEGKERNEL_H__ - -#include "arm_compute/core/CL/ICLKernel.h" - -namespace arm_compute -{ -class ICLTensor; - -/** OpenCL kernel to perform a negation operation on tensor*/ -class CLNegKernel : public ICLKernel -{ -public: - /** Default constructor */ - CLNegKernel(); - /** Prevent instances of this class from being copied (As this class contains pointers). */ - CLNegKernel(const CLNegKernel &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers). */ - CLNegKernel &operator=(const CLNegKernel &) = delete; - /** Allow instances of this class to be moved */ - CLNegKernel(CLNegKernel &&) = default; - /** Allow instances of this class to be moved */ - CLNegKernel &operator=(CLNegKernel &&) = default; - /** Initialize the kernel's input, output. - * - * @param[in] input Source tensor. - * @param[out] output Destination tensor. - */ - void configure(const ICLTensor *input, ICLTensor *output); - - // Inherited methods overridden: - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - const ICLTensor *_input; - ICLTensor *_output; -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_CLNEGKERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLOneHotKernel.h b/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLOneHotKernel.h deleted file mode 100644 index a512057b9..000000000 --- a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLOneHotKernel.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2020 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) 2018-2020 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_CLONEHOTKERNEL_H__ -#define __ARM_COMPUTE_CLONEHOTKERNEL_H__ -#include "arm_compute/core/CL/ICLKernel.h" -#include "arm_compute/core/Types.h" -namespace arm_compute -{ -class ICLTensor; -/** Interface for the kernel to perform one-hot encoding*/ -class CLOneHotKernel : public ICLKernel -{ -public: - /** Default constructor */ - CLOneHotKernel(); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLOneHotKernel(const CLOneHotKernel &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLOneHotKernel &operator=(const CLOneHotKernel &) = delete; - /** Allow instances of this class to be moved */ - CLOneHotKernel(CLOneHotKernel &&) = default; - /** Allow instances of this class to be moved */ - CLOneHotKernel &operator=(CLOneHotKernel &&) = default; - /** Default destructor */ - ~CLOneHotKernel() = default; - /** Initialise the kernel's inputs and output - * - * @param[in] indices Indices tensor. Supported tensor rank: up to 3. Must be one of the - * following types: U32/S32 - * @param[in] on_value On value tensor. Supported tensor rank: only 1. Data type supported: - * U8/S8/U16/S16/F16/U32/S32/F32 - * @param[in] off_value Off value tensor. Supported tensor rank: only 1. Data type supported: - * Same as @p on_value - * @param[out] output Destination tensor. Data type supported: Same as @p on_value - * @param[in] depth The depth of the one hot dimension. - * @param[in] axis (Optional) The axis to fill. Negative values wrap around. Defaults to -1. - * value must be in range [-indices.rank , indices.rank) - */ - void configure(const ICLTensor *indices, const ICLTensor *on_value, const ICLTensor *off_value, - ICLTensor *output, int depth, int axis = -1); - /** Initialise the kernel's inputs and output already initialized to off_value - * - * @param[in] indices Indices tensor. Supported tensor rank: up to 3. Must be one of the - * following types: U32/S32 - * @param[in] on_value On value tensor. Supported tensor rank: only 1. Data type supported: - * U8/S8/U16/S16/F16/U32/S32/F32 - * @param[out] output Destination tensor. Data type supported: Same as @p on_value - * @param[in] depth The depth of the one hot dimension. - * @param[in] axis (Optional) The axis to fill. Negative values wrap around. Defaults to -1. - * value must be in range [-indices.rank , indices.rank) - */ - void configure(const ICLTensor *indices, const ICLTensor *on_value, ICLTensor *output, int depth, - int axis = -1); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLOneHotKernel - * - * @param[in] indices Indices tensor. Supported tensor rank: up to 3. Must be one of the - * following types: U32/S32 - * @param[in] on_value On value tensor. Supported tensor rank: only 1. Data type supported: - * U8/S8/U16/S16/F16/U32/S32/F32 - * @param[in] off_value Off value tensor. Supported tensor rank: only 1. Data type supported: - * Same as @p on_value - * @param[in] output Destination tensor. Data type supported: Same as @p on_value - * @param[in] depth The depth of the one hot dimension. - * @param[in] axis (Optional) The axis to fill. Negative values wrap around. Defaults to -1. - * value must be in range [-indices.rank , indices.rank) - * - * @return a status - */ - static Status validate(const ITensorInfo *indices, const ITensorInfo *on_value, - const ITensorInfo *off_value, const ITensorInfo *output, int depth, - int axis = -1); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLOneHotKernel without off_value - * - * @param[in] indices Indices tensor. Supported tensor rank: up to 3. Must be one of the - * following types: U32/S32 - * @param[in] on_value On value tensor. Supported tensor rank: only 1. Data type supported: - * U8/S8/U16/S16/F16/U32/S32/F32 - * @param[in] output Destination tensor. Data type supported: Same as @p on_value - * @param[in] depth The depth of the one hot dimension. - * @param[in] axis (Optional) The axis to fill. Negative values wrap around. Defaults to -1. - * value must be in range [-indices.rank , indices.rank) - * - * @return a status - */ - static Status validate(const ITensorInfo *indices, const ITensorInfo *on_value, - const ITensorInfo *output, int depth, int axis = -1); - // Inherited methods overridden: - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - /** Initialise the kernel's inputs and outputs internally - * - * @param[in] indices Indices tensor. Supported tensor rank: up to 3. Must be one of the - * following types: U32/S32 - * @param[in] on_value On value tensor. Supported tensor rank: only 1. Data type supported: - * U8/S8/U16/S16/F16/U32/S32/F32 - * @param[out] output Destination tensor. Data type supported: Same as @p on_value - * @param[in] depth The depth of the one hot dimension. - * @param[in] axis (Optional) The axis to fill. Negative values wrap around. Defaults to -1. - * value must be in range [-indices.rank , indices.rank) - */ - void configure_common(const ICLTensor *indices, const ICLTensor *on_value, ICLTensor *output, - int depth, int axis); - -private: - const ICLTensor *_indices; /**< Indices tensor */ - const ICLTensor *_on_value; /**< On value tensor */ - const ICLTensor *_off_value; /**< Off value tensor */ - ICLTensor *_output; /**< Destination tensor */ - bool _is_off_value_memset; /**< Whether off_value is zero */ -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_CLONEHOTKERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLQuantizationSymmetricKernel.h b/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLQuantizationSymmetricKernel.h deleted file mode 100644 index 4e1b56cba..000000000 --- a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLQuantizationSymmetricKernel.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2020 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) 2017-2019 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_CLQUANTIZATIONSYMMETRICKERNEL_H__ -#define __ARM_COMPUTE_CLQUANTIZATIONSYMMETRICKERNEL_H__ - -#include "arm_compute/core/CL/ICLKernel.h" - -namespace arm_compute -{ -class ICLTensor; - -/** Interface for the quantization layer kernel. - * - * @note The implementation supports only 2D input tensors. - */ -class CLQuantizationSymmetricKernel : public ICLKernel -{ -public: - /** Default constructor */ - CLQuantizationSymmetricKernel(); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLQuantizationSymmetricKernel(const CLQuantizationSymmetricKernel &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLQuantizationSymmetricKernel &operator=(const CLQuantizationSymmetricKernel &) = delete; - /** Default Move Constructor. */ - CLQuantizationSymmetricKernel(CLQuantizationSymmetricKernel &&) = default; - /** Default move assignment operator */ - CLQuantizationSymmetricKernel &operator=(CLQuantizationSymmetricKernel &&) = default; - /** Default destructor */ - ~CLQuantizationSymmetricKernel() = default; - /** Set the input, output. - * - * @param[in] input Source tensor. Data types supported: F32/F16. - * @param[in] scale_factor Scale tensor of @p output. Data type supported: Same as @p input. - * @param[out] output Destination tensor with the same dimensions of input. Data types supported: - * S8. - * - * @note Output auto initialization is not supported by this kernel - */ - void configure(const ICLTensor *input, const ICLTensor *scale_factor, ICLTensor *output); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLQuantizationSymmetricKernel - * - * @param[in] input Input tensor info. Data types supported: F32/F16. - * @param[in] scale_factor Scale tensor of @p output. Data type supported: Same as @p input. - * @param[in] output Destination tensor info with the same dimensions of input. Data types - * supported: S8. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *scale_factor, - const ITensorInfo *output); - - // Inherited methods overridden: - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - const ICLTensor *_input; - const ICLTensor *_scale_factor; - ICLTensor *_output; -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_CLQUANTIZATIONSYMMETRICKERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLReduceOperationKernel.h b/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLReduceOperationKernel.h deleted file mode 100644 index 9b8a239d3..000000000 --- a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLReduceOperationKernel.h +++ /dev/null @@ -1,127 +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. - */ - -/** - * @file CLReduceOperationKernel.h - * @brief This file defines CLReduceOperationKernel class - * @ingroup COM_AI_RUNTIME - */ - -#ifndef __ARM_COMPUTE_CLREDUCEOPERATIONKERNEL_H__ -#define __ARM_COMPUTE_CLREDUCEOPERATIONKERNEL_H__ - -#include "arm_compute/core/CL/ICLKernel.h" -#include "arm_compute/core/TypesEx.h" - -namespace arm_compute -{ -class ICLTensor; - -/** - * @brief Class to define interface for the reduce operation kernel - */ -class CLReduceOperationKernel : public ICLKernel -{ -public: - /** - * @brief Default constructor - */ - CLReduceOperationKernel(); - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers) - */ - CLReduceOperationKernel(const CLReduceOperationKernel &) = delete; - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers) - */ - CLReduceOperationKernel &operator=(const CLReduceOperationKernel &) = delete; - /** - * @brief Allow instances of this class to be moved - */ - CLReduceOperationKernel(CLReduceOperationKernel &&) = default; - /** - * @brief Allow instances of this class to be moved - */ - CLReduceOperationKernel &operator=(CLReduceOperationKernel &&) = default; - /** - * @brief Default destructor - */ - ~CLReduceOperationKernel() = default; - - /** - * @brief Set the input and output tensors. - * @param[in] input Source tensor. Data types supported: U8/S32/F32. - * @param[out] output Destination tensor. Data types supported: Same as @p input. - * Output will have the same number of dimensions as input. - * @param[in] axis Axis along which to reduce. - * @param[in] op Reduce operation to perform. - * @return N/A - */ - void configure(const ICLTensor *input, ICLTensor *output, const uint32_t axis, - ReduceOperation op); - - /** - * @brief Static function to check if given info will lead to a valid configuration of @ref - * CLReduceOperationKernel. - * @param[in] input Source tensor info. Data types supported: U8/S32/F32. - * @param[in] output Destination tensor info. Data types supported: Same as @p input. - * Output will have the same number of dimensions as input. - * @param[in] axis Axis along which to reduce. - * @param[in] op Reduce operation to perform. - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, const uint32_t axis, - ReduceOperation op); - - /* - * @brief Run CLReduceOperationKernel op - * @param[in] window Window to be used for in_slice - * @param[in] queue CLQueue - * @return N/A - */ - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - const ICLTensor *_input; - ICLTensor *_output; - uint32_t _axis; -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_CLREDUCEOPERATIONKERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLScaleFactorSymm8Kernel.h b/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLScaleFactorSymm8Kernel.h deleted file mode 100644 index 4d4478ece..000000000 --- a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLScaleFactorSymm8Kernel.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2020 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) 2017-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_CLSCALEFACTORSYMM8KERNEL_H__ -#define __ARM_COMPUTE_CLSCALEFACTORSYMM8KERNEL_H__ - -#include "arm_compute/core/CL/ICLKernel.h" - -namespace arm_compute -{ -class ICLTensor; - -/** Interface for the kernel to perform min max search on a 3D tensor. - */ -class CLScaleFactorSymm8Kernel : public ICLKernel -{ -public: - /** Default constructor */ - CLScaleFactorSymm8Kernel(); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLScaleFactorSymm8Kernel(const CLScaleFactorSymm8Kernel &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLScaleFactorSymm8Kernel &operator=(const CLScaleFactorSymm8Kernel &) = delete; - /** Allow instances of this class to be moved */ - CLScaleFactorSymm8Kernel(CLScaleFactorSymm8Kernel &&) = default; - /** Allow instances of this class to be moved */ - CLScaleFactorSymm8Kernel &operator=(CLScaleFactorSymm8Kernel &&) = default; - /** Initialise the kernel's input and output. - * - * @param[in] input Input tensor with 2 dimensions. The first dimension will be interpreted as - * batches. Data types supported: F32. - * @param[out] output Output tensor with shape [batches] which stores the scale values for each 2D - * input tensor. - * The dimensions over the first must match the batched dimensions of the input - * tensor. Data types supported: F32. - */ - void configure(const ICLTensor *input, ICLTensor *output); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLScaleFactorSymm8Kernel - * - * @param[in] input Input tensor info. Data types supported: F32. - * @param[in] output Output tensor info with shape [batches] which stores the scale values for - * each 2D input tensor. - * The dimensions over the first must match the batched dimensions of the input - * tensor. Data types supported: F32. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output); - - /** Resets global minimum and maximum - * - * @param[in,out] queue Command queue on which to map and unmap the min_max tensor - */ - void reset(cl::CommandQueue &queue); - - // Inherited methods overridden: - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - const ICLTensor *_input; - ICLTensor *_output; -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_CLSCALEFACTORSYMM8KERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLTopKV2Kernel.h b/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLTopKV2Kernel.h deleted file mode 100644 index aa4a14812..000000000 --- a/compute/ARMComputeEx/arm_compute/core/CL/kernels/CLTopKV2Kernel.h +++ /dev/null @@ -1,680 +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. - */ - -/** - * @file CLTopKV2Kernel.h - * @brief This file defines classes for TopKV2Kernel - * @ingroup COM_AI_RUNTIME - */ - -#ifndef __ARM_COMPUTE_CLTOPKV2KERNEL_H__ -#define __ARM_COMPUTE_CLTOPKV2KERNEL_H__ - -#include "arm_compute/core/CL/ICLKernel.h" - -// these parameters can be changed -#define _ITEMS 16 // number of items in a group -#define _GROUPS 4 // the number of virtual processors is _ITEMS * _GROUPS -#define _HISTOSPLIT (_ITEMS * _GROUPS / 2) // number of splits of the histogram -#define PERMUT // store the final permutation -//////////////////////////////////////////////////////// - -// Disable GPU implementation -// TODO Enable GPU implementation with verification, or remove code -// Invalid result on GPU -#if 0 -namespace arm_compute -{ -class ICLTensor; - -/** - * @brief Class to define CLTopKV2Single - */ -class CLTopKV2Single : public ICLKernel -{ -public: - /** - * @brief Constructor - */ - CLTopKV2Single(); - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLTopKV2Single to be copied - */ - CLTopKV2Single(const CLTopKV2Single &) = delete; - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLTopKV2Single to be copied - * @return Reference of this instance - */ - CLTopKV2Single &operator=(const CLTopKV2Single &) = delete; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLTopKV2Single to be moved - */ - CLTopKV2Single(CLTopKV2Single &&) = default; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLTopKV2Single to be moved - * @return Reference of this instance - */ - CLTopKV2Single &operator=(CLTopKV2Single &&) = default; - - /** - * @brief Initialise kernel with params - * @param[in] input An input tensor - * @param[in] topk_values Values of the top k predictions - * @param[in] topk_indices Indices of the top k predictions - * @param[in] indices Indices - * @param[in] temp_stack Temp stack - * @param[in] k K of the top k predictions - * @param[in] n Number times to quick-sort - * return N/A - */ - void configure(ICLTensor *input, ICLTensor *topk_values, ICLTensor *topk_indices, - cl::Buffer *indices, cl::Buffer *temp_stack, int k, int n); - - /* - * @brief Run CLTopKV2Single op - * @param[in] window Window to be used for in_slice - * @param[in] queue cl::CommandQueue - * @return N/A - */ - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - ICLTensor *_input; - ICLTensor *_topk_values; - ICLTensor *_topk_indices; -}; - -/** - * @brief Class to define CLTopKV2Init - */ -class CLTopKV2Init : public ICLKernel -{ -public: - /** - * @brief Constructor - */ - CLTopKV2Init(); - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLTopKV2Init to be copied - */ - CLTopKV2Init(const CLTopKV2Init &) = delete; - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLTopKV2Init to be copied - * @return Reference of this instance - */ - CLTopKV2Init &operator=(const CLTopKV2Init &) = delete; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLTopKV2Init to be moved - */ - CLTopKV2Init(CLTopKV2Init &&) = default; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLTopKV2Init to be moved - * @return Reference of this instance - */ - CLTopKV2Init &operator=(CLTopKV2Init &&) = default; - - /** - * @brief Initialise kernel with params - * @param[in] input An input tensor - * @param[in] in_key_buf Buffer of input key - * @param[in] in_ind_buf Buffer of input index - * @param[in] n Number times to quick-sort - * return N/A - */ - void configure(ICLTensor *input, cl::Buffer *in_key_buf, cl::Buffer *in_ind_buf, int n); - - /* - * @brief Run CLTopKV2Init op - * @param[in] window Window to be used for in_slice - * @param[in] queue cl::CommandQueue - * @return N/A - */ - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - ICLTensor *_input; -}; - -/** - * @brief Class to define CLRadixSortHistogram - */ -class CLRadixSortHistogram : public ICLKernel -{ -public: - /** - * @brief Constructor - */ - CLRadixSortHistogram(); - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLRadixSortHistogram to be copied - */ - CLRadixSortHistogram(const CLRadixSortHistogram &) = delete; - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLRadixSortHistogram to be copied - * @return Reference of this instance - */ - CLRadixSortHistogram &operator=(const CLRadixSortHistogram &) = delete; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLRadixSortHistogram to be moved - */ - CLRadixSortHistogram(CLRadixSortHistogram &&) = default; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLRadixSortHistogram to be moved - * @return Reference of this instance - */ - CLRadixSortHistogram &operator=(CLRadixSortHistogram &&) = default; - - /** - * @brief Initialise kernel with params - * @param[out] hist_buf Buffer of histogram - * @param[in] bits Number of bits to be used for radix sort - * @param[in] n Integer number size to sort - * return N/A - */ - void configure(cl::Buffer *hist_buf, int bits, int n); - - /** - * @brief Set pass - * @param[in] pass Passes made of in radix sort algorithm - * @param[in] in_key_buf Buffer of input key - * return N/A - */ - void setPass(int pass, cl::Buffer *in_key_buf) - { - _pass = pass; - _in_key_buf = in_key_buf; - } - - /* - * @brief Run CLRadixSortHistogram op - * @param[in] window Window to be used for in_slice - * @param[in] queue cl::CommandQueue - * @return N/A - */ - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - int _pass; - cl::Buffer *_in_key_buf; -}; - -/** - * @brief Class to define CLRadixSortScanHistogram - */ -class CLRadixSortScanHistogram : public ICLKernel -{ -public: - /** - * @brief Constructor - */ - CLRadixSortScanHistogram(); - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLRadixSortScanHistogram to be copied - */ - CLRadixSortScanHistogram(const CLRadixSortScanHistogram &) = delete; - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLRadixSortScanHistogram to be copied - * @return Reference of this instance - */ - CLRadixSortScanHistogram &operator=(const CLRadixSortScanHistogram &) = delete; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLRadixSortScanHistogram to be moved - */ - CLRadixSortScanHistogram(CLRadixSortScanHistogram &&) = default; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLRadixSortScanHistogram to be moved - * @return Reference of this instance - */ - CLRadixSortScanHistogram &operator=(CLRadixSortScanHistogram &&) = default; - - /** - * @brief Initialise kernel with params - * @param[out] hist_buf Buffer of histogram - * @param[out] glob_sum_buf Buffer of global sum - * @param[in] bits Number of bits to be used for radix sort - * return N/A - */ - void configure(cl::Buffer *hist_buf, cl::Buffer *glob_sum_buf, int bits); - - /* - * @brief Run CLRadixSortScanHistogram op - * @param[in] window Window to be used for in_slice - * @param[in] queue cl::CommandQueue - * @return N/A - */ - void run(const Window &window, cl::CommandQueue &queue) override; -}; - -/** - * @brief Class to define CLRadixSortGlobalScanHistogram - */ -class CLRadixSortGlobalScanHistogram : public ICLKernel -{ -public: - /** - * @brief Constructor - */ - CLRadixSortGlobalScanHistogram(); - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLRadixSortGlobalScanHistogram to be copied - */ - CLRadixSortGlobalScanHistogram(const CLRadixSortGlobalScanHistogram &) = delete; - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLRadixSortGlobalScanHistogram to be copied - * @return Reference of this instance - */ - CLRadixSortGlobalScanHistogram &operator=(const CLRadixSortGlobalScanHistogram &) = delete; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLRadixSortGlobalScanHistogram to be moved - */ - CLRadixSortGlobalScanHistogram(CLRadixSortGlobalScanHistogram &&) = default; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLRadixSortGlobalScanHistogram to be moved - * @return Reference of this instance - */ - CLRadixSortGlobalScanHistogram &operator=(CLRadixSortGlobalScanHistogram &&) = default; - - /** - * @brief Initialise kernel with params - * @param[out] glob_sum_buf Buffer of global sum - * @param[out] temp_buf Temp buffer to be used while RadixSortGlobalScanHistogram - * @param[in] bits Number of bits to be used for radix sort - * return N/A - */ - void configure(cl::Buffer *glob_sum_buf, cl::Buffer *temp_buf, int bits); - - /* - * @brief Run CLRadixSortGlobalScanHistogram op - * @param[in] window Window to be used for in_slice - * @param[in] queue cl::CommandQueue - * @return N/A - */ - void run(const Window &window, cl::CommandQueue &queue) override; -}; - -/** - * @brief Class to define CLRadixSortPasteHistogram - */ -class CLRadixSortPasteHistogram : public ICLKernel -{ -public: - /** - * @brief Constructor - */ - CLRadixSortPasteHistogram(); - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLRadixSortPasteHistogram to be copied - */ - CLRadixSortPasteHistogram(const CLRadixSortPasteHistogram &) = delete; - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLRadixSortPasteHistogram to be copied - * @return Reference of this instance - */ - CLRadixSortPasteHistogram &operator=(const CLRadixSortPasteHistogram &) = delete; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLRadixSortPasteHistogram to be moved - */ - CLRadixSortPasteHistogram(CLRadixSortPasteHistogram &&) = default; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLRadixSortPasteHistogram to be moved - * @return Reference of this instance - */ - CLRadixSortPasteHistogram &operator=(CLRadixSortPasteHistogram &&) = default; - - /** - * @brief Initialise kernel with params - * @param[out] hist_buf Buffer of histogram - * @param[out] glob_sum_buf Buffer of global sum - * @param[in] bits Number of bits to be used for radix sort - * return N/A - */ - void configure(cl::Buffer *hist_buf, cl::Buffer *glob_sum_buf, int bits); - - /* - * @brief Run CLRadixSortPasteHistogram op - * @param[in] window Window to be used for in_slice - * @param[in] queue cl::CommandQueue - * @return N/A - */ - void run(const Window &window, cl::CommandQueue &queue) override; -}; - -/** - * @brief Class to define CLRadixSortReorder - */ -class CLRadixSortReorder : public ICLKernel -{ -public: - /** - * @brief Constructor - */ - CLRadixSortReorder(); - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLRadixSortReorder to be copied - */ - CLRadixSortReorder(const CLRadixSortReorder &) = delete; - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLRadixSortReorder to be copied - * @return Reference of this instance - */ - CLRadixSortReorder &operator=(const CLRadixSortReorder &) = delete; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLRadixSortReorder to be moved - */ - CLRadixSortReorder(CLRadixSortReorder &&) = default; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLRadixSortReorder to be moved - * @return Reference of this instance - */ - CLRadixSortReorder &operator=(CLRadixSortReorder &&) = default; - - /** - * @brief Initialise kernel with params - * @param[out] hist_buf Buffer of histogram - * @param[in] bits Number of bits to be used for radix sort - * @param[in] n Integer number size to sort - * return N/A - */ - void configure(cl::Buffer *hist_buf, int bits, int n); - - /** - * @brief Set pass - * @param[in] pass Passes made of in radix sort algorithm - * @param[in] in_key_buf Buffer of input key - * @param[out] out_key_buf Buffer of output key - * @param[in] in_ind_buf Buffer of input index - * @param[out] out_ind_buf Buffer of output index - * return N/A - */ - void setPass(int pass, cl::Buffer *in_key_buf, cl::Buffer *out_key_buf, cl::Buffer *in_ind_buf, - cl::Buffer *out_ind_buf) - { - _pass = pass; - _in_key_buf = in_key_buf; - _out_key_buf = out_key_buf; - _in_ind_buf = in_ind_buf; - _out_ind_buf = out_ind_buf; - } - /* - * @brief Run CLRadixSortReorder op - * @param[in] window Window to be used for in_slice - * @param[in] queue cl::CommandQueue - * @return N/A - */ - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - int _pass; - cl::Buffer *_in_key_buf; - cl::Buffer *_out_key_buf; - cl::Buffer *_in_ind_buf; - cl::Buffer *_out_ind_buf; -}; - -/** - * @brief Class to define CLTopKV2FindFirstNegative - */ -class CLTopKV2FindFirstNegative : public ICLKernel -{ -public: - /** - * @brief Constructor - */ - CLTopKV2FindFirstNegative(); - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLTopKV2FindFirstNegative to be copied - */ - CLTopKV2FindFirstNegative(const CLTopKV2FindFirstNegative &) = delete; - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLTopKV2FindFirstNegative to be copied - * @return Reference of this instance - */ - CLTopKV2FindFirstNegative &operator=(const CLTopKV2FindFirstNegative &) = delete; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLTopKV2FindFirstNegative to be moved - */ - CLTopKV2FindFirstNegative(CLTopKV2FindFirstNegative &&) = default; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLTopKV2FindFirstNegative to be moved - * @return Reference of this instance - */ - CLTopKV2FindFirstNegative &operator=(CLTopKV2FindFirstNegative &&) = default; - - /** - * @brief Initialise kernel with params - * @param[out] first_negative_idx_buf Buffer of the first negative index - * @param[in] n Number times to find - * return N/A - */ - void configure(cl::Buffer *first_negative_idx_buf, int n); - - /** - * @brief Set output buffer - * @param[out] out_key_buf Buffer of output key - * return N/A - */ - void setOutputBuffer(cl::Buffer *out_key_buf) { _out_key_buf = out_key_buf; } - - /* - * @brief Run CLTopKV2FindFirstNegative op - * @param[in] window Window to be used for in_slice - * @param[in] queue cl::CommandQueue - * @return N/A - */ - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - cl::Buffer *_out_key_buf; -}; - -/** - * @brief Class to define CLTopKV2ReorderNegatives - */ -class CLTopKV2ReorderNegatives : public ICLKernel -{ -public: - /** - * @brief Constructor - */ - CLTopKV2ReorderNegatives(); - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLTopKV2ReorderNegatives to be copied - */ - CLTopKV2ReorderNegatives(const CLTopKV2ReorderNegatives &) = delete; - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLTopKV2ReorderNegatives to be copied - * @return Reference of this instance - */ - CLTopKV2ReorderNegatives &operator=(const CLTopKV2ReorderNegatives &) = delete; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLTopKV2ReorderNegatives to be moved - */ - CLTopKV2ReorderNegatives(CLTopKV2ReorderNegatives &&) = default; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLTopKV2ReorderNegatives to be moved - * @return Reference of this instance - */ - CLTopKV2ReorderNegatives &operator=(CLTopKV2ReorderNegatives &&) = default; - - /** - * @brief Initialise kernel with params - * @param[out] first_negative_idx_buf Buffer of the first negative index - * @param[in] n Number times to find - * return N/A - */ - void configure(cl::Buffer *first_negative_idx_buf, int n); - - /** - * @brief Set buffers - * @param[in] in_key_buf Buffer of input key - * @param[out] out_key_buf Buffer of output key - * @param[in] in_ind_buf Buffer of input index - * @param[out] out_ind_buf Buffer of output index - * return N/A - */ - void setBuffers(cl::Buffer *in_key_buf, cl::Buffer *out_key_buf, cl::Buffer *in_ind_buf, - cl::Buffer *out_ind_buf) - { - _in_key_buf = in_key_buf; - _out_key_buf = out_key_buf; - _in_ind_buf = in_ind_buf; - _out_ind_buf = out_ind_buf; - } - - /* - * @brief Run CLTopKV2ReorderNegatives op - * @param[in] window Window to be used for in_slice - * @param[in] queue cl::CommandQueue - * @return N/A - */ - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - cl::Buffer *_in_key_buf; - cl::Buffer *_out_key_buf; - cl::Buffer *_in_ind_buf; - cl::Buffer *_out_ind_buf; -}; - -/** - * @brief Class to define CLTopKV2Store - */ -class CLTopKV2Store : public ICLKernel -{ -public: - /** - * @brief Constructor - */ - CLTopKV2Store(); - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLTopKV2Store to be copied - */ - CLTopKV2Store(const CLTopKV2Store &) = delete; - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers). - * @param [in] copiedInstance Const reference of CLTopKV2Store to be copied - * @return Reference of this instance - */ - CLTopKV2Store &operator=(const CLTopKV2Store &) = delete; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLTopKV2Store to be moved - */ - CLTopKV2Store(CLTopKV2Store &&) = default; - /** - * @brief Allow instances of this class to be moved - * @param [in] movedInstance Rvalue reference of CLTopKV2Store to be moved - * @return Reference of this instance - */ - CLTopKV2Store &operator=(CLTopKV2Store &&) = default; - - /** - * @brief Initialise kernel with params - * @param[out] values Values tensor to store - * @param[out] indices Indices tensor to be used for store - * @param[in] k K of the top k predictions - * @param[in] n Number times to store - * return N/A - */ - void configure(ICLTensor *values, ICLTensor *indices, int k, int n); - - /** - * @brief Set buffers - * @param[out] out_key_buf Buffer of output key - * @param[out] out_ind_buf Buffer of output index - * return N/A - */ - void setOutputBuffers(cl::Buffer *out_key_buf, cl::Buffer *out_ind_buf); - - /* - * @brief Run CLTopKV2Store op - * @param[in] window Window to be used for in_slice - * @param[in] queue cl::CommandQueue - * @return N/A - */ - void run(const Window &window, cl::CommandQueue &queue) override; - -private: - ICLTensor *_values; - ICLTensor *_indices; - cl::Buffer *_out_key_buf; - cl::Buffer *_out_ind_buf; -}; - -} // namespace arm_compute -#endif // Disable GPU implementation -#endif // __ARM_COMPUTE_CLTOPKV2KERNEL_H__ diff --git a/compute/ARMComputeEx/arm_compute/core/NEON/NEElementwiseOperationFuncs.h b/compute/ARMComputeEx/arm_compute/core/NEON/NEElementwiseOperationFuncs.h deleted file mode 100644 index 933d8760d..000000000 --- a/compute/ARMComputeEx/arm_compute/core/NEON/NEElementwiseOperationFuncs.h +++ /dev/null @@ -1,68 +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. - */ - -/* - * 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_NEELEMENTWISEOPERATIONFUNCS_H__ -#define __ARM_COMPUTE_NEELEMENTWISEOPERATIONFUNCS_H__ - -#include <arm_neon.h> - -namespace arm_compute -{ -class ITensor; -class Window; -class QuantizationInfo; -} // namespace arm_compute - -namespace arm_compute -{ - -void elementwise_op(const ITensor *in1, const ITensor *in2, ITensor *out, const Window &window, - float (*scalar_func)(const float &, const float &), - int (*broadcast_func)(int, int, int, const float *, const float &, float *, - const bool), - int (*neon_func)(int, int, int, const float *, const float *, float *)); - -void elementwise_op(const ITensor *in1, const ITensor *in2, ITensor *out, const Window &window, - uint8_t (*scalar_func)(const uint8_t &, const uint8_t &), - int (*broadcast_func)(int, int, int, const uint8_t *, const uint8_t &, - uint8_t *, const bool), - int (*neon_func)(int, int, int, const uint8_t *, const uint8_t *, uint8_t *)); -} // namespace arm_compute -#endif // __ARM_COMPUTE_NEELEMENTWISEOPERATIONFUNCS_H__ diff --git a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEActivationLayerKernelEx.h b/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEActivationLayerKernelEx.h deleted file mode 100644 index a827f48f8..000000000 --- a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEActivationLayerKernelEx.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2020 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) 2017-2019 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_NEACTIVATIONLAYERKERNELEX_H__ -#define __ARM_COMPUTE_NEACTIVATIONLAYERKERNELEX_H__ - -#include "arm_compute/core/NEON/INEKernel.h" -#include "arm_compute/core/utils/misc/Traits.h" - -#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC -#include <arm_fp16.h> -#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */ - -namespace arm_compute -{ -class ITensor; - -/** Interface for the activation layer kernel. */ -class NEActivationLayerKernelEx : public INEKernel -{ -public: - const char *name() const override { return "NEActivationLayerKernelEx"; } - /** Constructor */ - NEActivationLayerKernelEx(); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEActivationLayerKernelEx(const NEActivationLayerKernelEx &) = delete; - /** Default move constructor */ - NEActivationLayerKernelEx(NEActivationLayerKernelEx &&) = default; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEActivationLayerKernelEx &operator=(const NEActivationLayerKernelEx &) = delete; - /** Default move assignment operator */ - NEActivationLayerKernelEx &operator=(NEActivationLayerKernelEx &&) = default; - /** Set the input and output tensor. - * - * @note If the output tensor is a nullptr, the activation function will be performed in-place - * - * @param[in, out] input Source tensor. In case of @p output tensor = nullptr, this - * tensor will store the result - * of the activation function. Data types supported: - * QASYMM8/QSYMM16/F16/F32. - * @param[out] output Destination tensor. Data type supported: same as @p input - * @param[in] activation_info Activation layer information. - */ - void configure(ITensor *input, ITensor *output, ActivationLayerInfo activation_info); - /** Static function to check if given info will lead to a valid configuration of @ref - * NEActivationLayerKernelEx - * - * @param[in] input Source tensor info. In case of @p output tensor info = nullptr, this tensor - * will store the result - * of the activation function. Data types supported: QASYMM8/QSYMM16/F16/F32. - * @param[in] output Destination tensor info. Data type supported: same as @p input - * @param[in] act_info Activation layer information. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, - const ActivationLayerInfo &act_info); - - // Inherited methods overridden: - void run(const Window &window, const ThreadInfo &info) override; - -private: - using ActivationFunction = ActivationLayerInfo::ActivationFunction; - /** Common signature for all the specialised @ref NEActivationLayerKernelEx functions - * - * @param[in] window Region on which to execute the kernel. - */ - using ActivationFunctionExecutorPtr = void (NEActivationLayerKernelEx::*)(const Window &window); - /** Function to apply an activation function on a tensor. - * - * @param[in] window Region on which to execute the kernel - */ - template <ActivationLayerInfo::ActivationFunction F, typename T> - typename std::enable_if<arm_compute::utils::traits::is_floating_point<T>::value, void>::type - activation(const Window &window); - /** Function to apply an activation function on a tensor. - * - * @param[in] window Region on which to execute the kernel - */ - template <ActivationLayerInfo::ActivationFunction F, typename T> - typename std::enable_if<std::is_same<T, qasymm8_t>::value, void>::type - activation(const Window &window); - /** Function to apply an activation function on a tensor. - * - * @param[in] window Region on which to execute the kernel - */ - template <ActivationLayerInfo::ActivationFunction F, typename T> - typename std::enable_if<std::is_same<T, qsymm16_t>::value, void>::type - activation(const Window &window); - -private: - ITensor *_input; - ITensor *_output; - ActivationFunctionExecutorPtr _func; - ActivationLayerInfo _act_info; -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_NEACTIVATIONLAYERKERNELEX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEBinaryLogicalOperationKernel.h b/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEBinaryLogicalOperationKernel.h deleted file mode 100644 index 8c544cda8..000000000 --- a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEBinaryLogicalOperationKernel.h +++ /dev/null @@ -1,86 +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. - */ - -/* - * Copyright (c) 2018-2019 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_NEBINARYLOGICALOPERATIONKERNEL_H__ -#define __ARM_COMPUTE_NEBINARYLOGICALOPERATIONKERNEL_H__ - -#include "arm_compute/core/NEON/kernels/NEElementwiseOperationKernel.h" -#include "arm_compute/core/TypesEx.h" - -namespace arm_compute -{ - -class NEBinaryLogicalOperationKernel : public NEElementwiseOperationKernel -{ -public: - /** Default destructor */ - ~NEBinaryLogicalOperationKernel() = default; - - /** Static function to check if given info will lead to a valid configuration of @ref - * NEBinaryLogicalOperationKernel - * - * @param[in] op Binary logical operation to be executed. - * @param[in] input1 First tensor input. Data types supported: QASYMM8/U8. - * @param[in] input2 Second tensor input. Data types supported: Same as @p input1. - * @param[in] output Output tensor. Data types supported: Same as @p input1. - */ - void configure(BinaryLogicalOperation op, const ITensor *input1, const ITensor *input2, - ITensor *output); - - /** Static function to check if given info will lead to a valid configuration of @ref - * NEBinaryLogicalOperationKernel - * - * @param[in] op Binary logical operation to be executed. - * @param[in] input1 First tensor input info. Data types supported: QASYMM8/U8. - * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. - * @param[in] output Output tensor info. Data types supported: Same as @p input1. - * - * @return a Status - */ - static Status validate(BinaryLogicalOperation op, const ITensorInfo *input1, - const ITensorInfo *input2, const ITensorInfo *output); - -protected: - // Inherited methods overridden: - static Status validate_arguments(const ITensorInfo &input1, const ITensorInfo &input2, - const ITensorInfo &output); -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_NEBINARYLOGICALOPERATIONKERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NECastBoolKernel.h b/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NECastBoolKernel.h deleted file mode 100644 index 101f6ac8e..000000000 --- a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NECastBoolKernel.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2020 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-2020 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_NECASTBOOLKERNEL_H__ -#define __ARM_COMPUTE_NECASTBOOLKERNEL_H__ - -#include "arm_compute/core/NEON/INEKernel.h" - -namespace arm_compute -{ -class ITensor; - -/** - * @brief Class for the kernel converting boolean type - */ -class NECastBoolKernel : public INEKernel -{ -public: - const char *name() const override { return "NECastBoolKernel"; } - /** Default constructor*/ - NECastBoolKernel(); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NECastBoolKernel(const NECastBoolKernel &) = delete; - /** Default move constructor */ - NECastBoolKernel(NECastBoolKernel &&) = default; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NECastBoolKernel &operator=(const NECastBoolKernel &) = delete; - /** Default move assignment operator */ - NECastBoolKernel &operator=(NECastBoolKernel &&) = default; - /** Set the input and output of the kernel - * - * Valid conversions Input -> Output : - * - * - U8 -> U8, S8, U16, S16, U32, S32, F32, F16 - * - * @param[in] input The input tensor to convert. Data types supported: U8 - * @param[out] output The output tensor. Data types supported: U8/S8/U16/S16/U32/S32/F16/F32. - */ - void configure(const ITensor *input, ITensor *output); - /** Static function to check if given info will lead to a valid configuration of @ref - * NECastBoolKernel - * - * @param[in] input Source tensor info. Data types supported: U8 - * @param[in] output Destination tensor info. Data type supported: U8/S8/U16/S16/U32/S32/F16/F32. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output); - - // Inherited methods overridden: - void run(const Window &window, const ThreadInfo &info) override; - -private: - const ITensor *_input; - ITensor *_output; -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_NECASTBOOLKERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEEmbeddingLookupKernel.h b/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEEmbeddingLookupKernel.h deleted file mode 100644 index 88f21c96e..000000000 --- a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEEmbeddingLookupKernel.h +++ /dev/null @@ -1,95 +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. - */ - -/* - * Copyright (c) 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_NEEMBEDDINGLOOKUPKERNEL_H__ -#define __ARM_COMPUTE_NEEMBEDDINGLOOKUPKERNEL_H__ - -#include "arm_compute/core/NEON/INEKernel.h" -#include "arm_compute/core/Types.h" - -namespace arm_compute -{ -class ITensor; - -/** NEON kernel to perform EmbeddingLookup operation */ -class NEEmbeddingLookupKernel : public INEKernel -{ -public: - const char *name() const override { return "NEEmbeddingLookupKernel"; } - /** Default constructor */ - NEEmbeddingLookupKernel(); - /** Prevent instances of this class from being copied (As this class contains pointers). */ - NEEmbeddingLookupKernel(const NEEmbeddingLookupKernel &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers). */ - NEEmbeddingLookupKernel &operator=(const NEEmbeddingLookupKernel &) = delete; - /** Allow instances of this class to be moved */ - NEEmbeddingLookupKernel(NEEmbeddingLookupKernel &&) = default; - /** Allow instances of this class to be moved */ - NEEmbeddingLookupKernel &operator=(NEEmbeddingLookupKernel &&) = default; - /** Initialize the kernel's input, output. - * - * @param[in] input Source tensor. Data types supported: U8/S8/QASYMM8/U16/S16/F16/U32/S32/F32. - * @param[out] output Destination tensor. Data types supported: same as @p input. - * @param[in] lookups Lookups are 1D tensor that values are indices into the first dimension of - * input. - */ - void configure(const ITensor *input, ITensor *output, const ITensor *lookups); - /** Static function to check if given info will lead to a valid configuration of @ref - * NEEmbeddingLookupKernel - * - * @param[in] input Source tensor. Data types supported: U8/S8/QASYMM8/U16/S16/F16/U32/S32/F32. - * @param[in] output Destination tensor. Data types supported: same as @p input. - * @param[in] lookups Lookups info. Data types supported: S32. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, - const ITensorInfo *lookups); - - // Inherited methods overridden: - void run(const Window &window, const ThreadInfo &info) override; - -private: - const ITensor *_input; - const ITensor *_lookups; - ITensor *_output; -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_NEEMBEDDINGLOOKUPKERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEGatherKernelEx.h b/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEGatherKernelEx.h deleted file mode 100644 index 5acfde5a8..000000000 --- a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEGatherKernelEx.h +++ /dev/null @@ -1,134 +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. - */ - -/* - * Copyright (c) 2019 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_NEGATHERKERNELEX_H__ -#define __ARM_COMPUTE_NEGATHERKERNELEX_H__ - -#include "arm_compute/core/NEON/INEKernel.h" -#include "arm_compute/core/Types.h" - -namespace arm_compute -{ -class ITensor; - -/** Kernel to perform other operation on NEON */ -class NEGatherKernelEx : public INEKernel -{ -public: - /** Default constructor. */ - NEGatherKernelEx(); - /** Prevent instances of this class from being copied (As this class contains pointers). */ - NEGatherKernelEx(const NEGatherKernelEx &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers). */ - NEGatherKernelEx &operator=(const NEGatherKernelEx &) = delete; - /** Allow instances of this class to be moved. */ - NEGatherKernelEx(NEGatherKernelEx &&) = default; - /** Allow instances of this class to be moved. */ - NEGatherKernelEx &operator=(NEGatherKernelEx &&) = default; - /** Default detructor */ - ~NEGatherKernelEx() = default; - - /** Name of the kernel - * - * @return Kernel name - */ - const char *name() const override { return "NEGatherKernelEx"; } - /** Initialise the kernel's inputs and outputs - * - * @param[in] input Source tensor. Supported tensor rank: up to 4. Data type supported: - * U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32 - * @param[in] indices Indices tensor. Supported tensor rank: up to 3. Must be one of the - * following type: U32/S32. Each value Must be in range [0, input.shape[@p axis]) - * @param[out] output Destination tensor. Data type supported: Same as @p input - * @param[in] axis (Optional) The axis in @p input to gather @p indices from. Negative values - * wrap around. Defaults to 0 - */ - void configure(const ITensor *input, const ITensor *indices, ITensor *output, int axis = 0); - /** Static function to check if given info will lead to a valid configuration of @ref - * NEGatherKernelEx - * - * @param[in] input Source tensor info. Supported tensor rank: up to 4. Data type supported: - * U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32 - * @param[in] indices Indices tensor info. Supported tensor rank: up to 3. Must be one of the - * following type: U32/S32. Each value Must be in range [0, input.shape[@p axis]) - * @param[in] output Destination tensor info. Data type supported: Same as @p input - * @param[in] axis (Optional) The axis in @p input to gather @p indices from. Negative values - * wrap around. Defaults to 0 - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *indices, - const ITensorInfo *output, int axis); - - // Inherited methods overridden: - void run(const Window &window, const ThreadInfo &info) override; - -private: - /** Implementation of the gather operation for 0 axis. - * - * For gather on the 0 axis an element by element copy is performed. - * - * @param[in] window Region on which to execute the kernel. (Must be a region of the window - * returned by window()) - * @param[in] info Info about executing thread and CPU. - */ - template <typename U> void gather_0_axis(const Window &window, const ThreadInfo &info); - - /** Implementation of the gather operation. - * - * For 1<=axis a row-wise copy is taking place. - * - * @param[in] window Region on which to execute the kernel. (Must be a region of the window - * returned by window()) - * @param[in] info Info about executing thread and CPU. - */ - template <typename U> void gather_n_axis(const Window &window, const ThreadInfo &info); - - using kernel_ptr = void (NEGatherKernelEx::*)(const Window &window, const ThreadInfo &info); - - const ITensor *_input; - const ITensor *_indices; - int _axis; - size_t _indices_rank; - ITensor *_output; - kernel_ptr _func; -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_NEGATHERKERNELEX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEHashtableLookupKernel.h b/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEHashtableLookupKernel.h deleted file mode 100644 index cb2a485d5..000000000 --- a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEHashtableLookupKernel.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. - */ - -/* - * Copyright (c) 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_NEHASHTABLELOOKUPKERNEL_H__ -#define __ARM_COMPUTE_NEHASHTABLELOOKUPKERNEL_H__ - -#include "arm_compute/core/NEON/INEKernel.h" -#include "arm_compute/core/Types.h" - -namespace arm_compute -{ -class ITensor; - -/** NEON kernel to perform HashtableLookup operation */ -class NEHashtableLookupKernel : public INEKernel -{ -public: - const char *name() const override { return "NEHashtableLookupKernel"; } - /** Default constructor */ - NEHashtableLookupKernel(); - /** Prevent instances of this class from being copied (As this class contains pointers). */ - NEHashtableLookupKernel(const NEHashtableLookupKernel &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers). */ - NEHashtableLookupKernel &operator=(const NEHashtableLookupKernel &) = delete; - /** Allow instances of this class to be moved */ - NEHashtableLookupKernel(NEHashtableLookupKernel &&) = default; - /** Allow instances of this class to be moved */ - NEHashtableLookupKernel &operator=(NEHashtableLookupKernel &&) = default; - /** Initialize the kernel's inputs, outputs. - * - * @param[in] lookups Lookups 1D tensor that values are indices into the first dimension of - * input. Data types supported: S32 - * @param[in] keys Keys 1D tensor. keys and input pair represent a map. - * Data types supported: S32 - * @param[in] input Source tensor. - * Data types supported: U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32 - * @param[out] output Destination tensor. Data types and data layouts supported: Same as @p - * input. - * @param[out] hits Hits 1D tensor. A boolean tensor that indicates whether the lookup hits - * (True) or not (False). Data types supported: U8/QASYMM8 - * input. - */ - void configure(const ITensor *lookups, const ITensor *keys, const ITensor *input, ITensor *output, - ITensor *hits); - /** Static function to check if given info will lead to a valid configuration of @ref - * NEHashtableLookupKernel - * - * @param[in] lookups The lookups tensor info. Data types supported: S32. - * @param[in] keys The keys tensor info. keys and input pair represent a map. - * Data types supported: S32 - * @param[in] input The input tensor info. - * Data types supported: U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32 - * @param[out] output The output tensor info. Data types and data layouts supported: Same as @p - * input. - * @param[out] hits The hits tensor info. A boolean tensor that indicates whether the lookup - * hits (True) or not (False). Data types supported: U8/QASYMM8 - * - * @return a status - */ - static Status validate(const ITensorInfo *lookups, const ITensorInfo *keys, - const ITensorInfo *input, const ITensorInfo *output, - const ITensorInfo *hits); - - // Inherited methods overridden: - void run(const Window &window, const ThreadInfo &info) override; - -private: - const ITensor *_lookups; /** Lookups tensor */ - const ITensor *_keys; /** Keys tensor */ - const ITensor *_input; /** Source tensor */ - ITensor *_output; /** Destination tensor */ - ITensor *_hits; /** Hits tensor */ -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_NEHASHTABLELOOKUPKERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEInstanceNormalizationLayerKernelEx.h b/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEInstanceNormalizationLayerKernelEx.h deleted file mode 100644 index 8724cc69b..000000000 --- a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEInstanceNormalizationLayerKernelEx.h +++ /dev/null @@ -1,131 +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. - */ - -/* - * Copyright (c) 2019 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_NEINSTANCENORMALIZATIONLAYERKERNELEX_H__ -#define __ARM_COMPUTE_NEINSTANCENORMALIZATIONLAYERKERNELEX_H__ - -#include "arm_compute/core/NEON/INEKernel.h" - -namespace arm_compute -{ -class ITensor; - -/** Interface for performing an instance normalization */ -class NEInstanceNormalizationLayerKernelEx : public INEKernel -{ -public: - const char *name() const override { return "NEInstanceNormalizationLayerKernelEx"; } - /** Default constructor */ - NEInstanceNormalizationLayerKernelEx(); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEInstanceNormalizationLayerKernelEx(const NEInstanceNormalizationLayerKernelEx &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEInstanceNormalizationLayerKernelEx & - operator=(const NEInstanceNormalizationLayerKernelEx &) = delete; - /** Allow instances of this class to be moved */ - NEInstanceNormalizationLayerKernelEx(NEInstanceNormalizationLayerKernelEx &&) = default; - /** Allow instances of this class to be moved */ - NEInstanceNormalizationLayerKernelEx & - operator=(NEInstanceNormalizationLayerKernelEx &&) = default; - /** Default destructor */ - ~NEInstanceNormalizationLayerKernelEx() = default; - /** Set the input and output tensors. - * - * @param[in, out] input Source tensor. Data types supported: F16/F32. Data layout supported: - * NCHW - * In case of @p output tensor = nullptr this tensor will store the result - * of the normalization. - * @param[out] output Destination tensor. Data types and data layouts supported: same as @p - * input. - * @param[in] gamma (Optional) The scale scalar value applied to the normalized tensor. - * Defaults to 1.0 - * @param[in] beta (Optional) The offset scalar value applied to the normalized tensor. - * Defaults to 0.0 - * @param[in] epsilon (Optional) Lower bound value for the normalization. Defaults to 1e-12 - */ - void configure(ITensor *input, ITensor *output, ITensor *gamma = nullptr, ITensor *beta = nullptr, - float epsilon = 1e-12f); - - /** Static function to check if given info will lead to a valid configuration of @ref - * NEInstanceNormalizationLayer. - * - * @param[in] input Source tensor info. Data types supported: F16/F32. Data layout supported: - * NCHW - * @param[in] output Destination tensor info. Data types and data layouts supported: same as @p - * input. - * @param[in] gamma (Optional) The scale scalar value applied to the normalized tensor. Defaults - * to 1.0 - * @param[in] beta (Optional) The offset scalar value applied to the normalized tensor. - * Defaults to 0.0 - * @param[in] epsilon (Optional) Lower bound value for the normalization. Defaults to 1e-12 - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, - const ITensorInfo *gamma = nullptr, const ITensorInfo *beta = nullptr, - float epsilon = 1e-12f); - - // Inherited methods overridden: - void run(const Window &window, const ThreadInfo &info) override; - -private: - /** Common signature for all the specialized instance normalization functions - * - * @param[in, out] input An input tensor. In case of @p output tensor = nullptr this tensor will - * store the result of the normalization. - * @param[out] output The output tensor. - * @param[in] gamma The scale scalar value applied to the normalized tensor. Defaults to - * 1.0 - * @param[in] beta The offset scalar value applied to the normalized tensor. Defaults to - * 0.0 - * @param[in] epsilon Lower bound value for the normalization. Defaults to 1e-12 - */ - using NormalizationFunction = void(ITensor *input, ITensor *output, ITensor *gamma, ITensor *beta, - float epsilon, const Window &window); - - NormalizationFunction *_func; - ITensor *_input; - ITensor *_output; - ITensor *_gamma; - ITensor *_beta; - float _epsilon; -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_NEINSTANCENORMALIZATIONLAYERKERNELEX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEMuliplyScaleFactorKernel.h b/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEMuliplyScaleFactorKernel.h deleted file mode 100644 index 198b0be9d..000000000 --- a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEMuliplyScaleFactorKernel.h +++ /dev/null @@ -1,99 +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. - */ - -/* - * Copyright (c) 2017-2019 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_NEMULTIPLYSCALEFACTORKERNEL_H__ -#define __ARM_COMPUTE_NEMULTIPLYSCALEFACTORKERNEL_H__ - -#include "arm_compute/core/NEON/INEKernel.h" - -namespace arm_compute -{ -class ITensor; - -/** Interface to multiply scale factor kernel. */ -class NEMultiplyScaleFactorKernel : public INEKernel -{ -public: - const char *name() const override { return "NEMultiplyScaleFactorKernel"; } - /** Default constructor */ - NEMultiplyScaleFactorKernel(); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEMultiplyScaleFactorKernel(const NEMultiplyScaleFactorKernel &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEMultiplyScaleFactorKernel &operator=(const NEMultiplyScaleFactorKernel &) = delete; - /** Default Move Constructor. */ - NEMultiplyScaleFactorKernel(NEMultiplyScaleFactorKernel &&) = default; - /** Default move assignment operator */ - NEMultiplyScaleFactorKernel &operator=(NEMultiplyScaleFactorKernel &&) = default; - /** Default destructor */ - ~NEMultiplyScaleFactorKernel() = default; - /** Set input, output tensors. - * - * @param[in/out] input Source tensor. Data type supported: S32. - * @param[in] scale_factor Scale tensor. Data type supported: F16/F32. - * @param[out] output Destination tensor. Data type supported: Same as @p scale_factor. - */ - void configure(const ITensor *input, const ITensor *scale_factor, ITensor *output, - float multiplier = 1.f); - /** Static function to check if given info will lead to a valid configuration of @ref - * NEMultiplyScaleFactorKernel - * - * @param[in] input Input tensor info. Data types supported: S32. - * @param[in] scale_factor Scale tensor. Data type supported: F16/F32. - * @param[in] output Output tensor info. Data types supported: Same as @p scale_factor. - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *scale_factor, - const ITensorInfo *output, float multiplier = 1.f); - - // Inherited methods overridden: - void run(const Window &window, const ThreadInfo &info) override; - -private: - template <typename T> void multiply(const Window &window); - -private: - const ITensor *_input; - const ITensor *_scale_factor; - ITensor *_output; - float _multiplier; -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_NEMULTIPLYSCALEFACTORKERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEOneHotKernel.h b/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEOneHotKernel.h deleted file mode 100644 index 99bb351bc..000000000 --- a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEOneHotKernel.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2020 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) 2019 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_NEONEHOTKERNEL_H__ -#define __ARM_COMPUTE_NEONEHOTKERNEL_H__ -#include "arm_compute/core/NEON/INEKernel.h" -#include "arm_compute/core/Types.h" -namespace arm_compute -{ -// Forward declarations -class ITensor; -/** Kernel to perform other operation on NEON */ -class NEOneHotKernel : public INEKernel -{ -public: - /** Default constructor. */ - NEOneHotKernel(); - /** Prevent instances of this class from being copied (As this class contains pointers). */ - NEOneHotKernel(const NEOneHotKernel &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers). */ - NEOneHotKernel &operator=(const NEOneHotKernel &) = delete; - /** Allow instances of this class to be moved. */ - NEOneHotKernel(NEOneHotKernel &&) = default; - /** Allow instances of this class to be moved. */ - NEOneHotKernel &operator=(NEOneHotKernel &&) = default; - /** Default detructor */ - ~NEOneHotKernel() = default; - /** Name of the kernel - * - * @return Kernel name - */ - const char *name() const override { return "NEOneHotKernel"; } - /** Initialise the kernel's inputs and outputs - * - * @param[in] indices Indices tensor. Supported tensor rank: up to 3. Must be one of the - * following types: U32/S32 - * @param[in] depth The tensor for depth of the one hot dimension. Supported tensor rank: up to - * 3. Must be one of the following types: U32/S32 - * @param[in] on_value On value tensor. Supported tensor rank: only 1. Data type supported: - * U8/S8/U16/S16/F16/U32/S32/F32 - * @param[in] off_value Off value tensor. Supported tensor rank: only 1. Data type supported: Same - * as @p on_value - * @param[out] output Destination tensor. Data type supported: Same as @p on_value - * @param[in] axis (Optional) The axis to fill. Negative values wrap around. Defaults to -1. - * The value must be in range [-indices.rank , indices.rank) - */ - void configure(const ITensor *indices, const ITensor *depth, const ITensor *on_value, - const ITensor *off_value, ITensor *output, int axis = -1); - /** Static function to check if given info will lead to a valid configuration of @ref - * NEOneHotKernel - * - * @param[in] indices Indices tensor info. Supported tensor rank: up to 3. Must be one of the - * following types: U32/S32 - * @param[in] depth The tensor info for depth of the one hot dimension. Supported tensor rank: - * up to 3. Must be one of the following types: U32/S32 - * @param[in] on_value On value tensor info. Supported tensor rank: only 1. Data type supported: - * U8/S8/U16/S16/F16/U32/S32/F32 - * @param[in] off_value Off value tensor info. Supported tensor rank: only 1. Data type supported: - * Same as @p on_value - * @param[out] output Destination tensor info. Data type supported: Same as @p on_value - * @param[in] axis (Optional) The axis to fill. Negative values wrap around. Defaults to -1. - * The value must be in range [-indices.rank , indices.rank) - * - * @return a status - */ - static Status validate(const ITensorInfo *indices, const ITensorInfo *depth, - const ITensorInfo *on_value, const ITensorInfo *off_value, - const ITensorInfo *output, int axis = -1); - // Inherited methods overridden: - void run(const Window &window, const ThreadInfo &info) override; - -private: - /** Implementation of the onehot operation for 0 axis. - * - * For onehot on the 0 axis an element by element copy is performed. - * - * @param[in] window Region on which to execute the kernel. (Must be a region of the window - * returned by window()) - * @param[in] info Info about executing thread and CPU. - */ - template <typename U> void onehot_0_axis(const Window &window, const ThreadInfo &info); - /** Implementation of the onehot operation. - * - * For 1<=axis a row-wise copy is taking place. - * - * @param[in] window Region on which to execute the kernel. (Must be a region of the window - * returned by window()) - * @param[in] info Info about executing thread and CPU. - */ - template <typename U> void onehot_n_axis(const Window &window, const ThreadInfo &info); - using kernel_ptr = void (NEOneHotKernel::*)(const Window &window, const ThreadInfo &info); - const ITensor *_indices; - const ITensor *_depth; - const ITensor *_on_value; - const ITensor *_off_value; - int _axis; - ITensor *_output; - kernel_ptr _func; -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_NEONEHOTKERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEQuantizationSymmetricKernel.h b/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEQuantizationSymmetricKernel.h deleted file mode 100644 index 0b080cf73..000000000 --- a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEQuantizationSymmetricKernel.h +++ /dev/null @@ -1,98 +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. - */ - -/* - * Copyright (c) 2017-2019 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_NEQUANTIZATIONSYMMETRICKERNEL_H__ -#define __ARM_COMPUTE_NEQUANTIZATIONSYMMETRICKERNEL_H__ - -#include "arm_compute/core/NEON/INEKernel.h" - -namespace arm_compute -{ -class ITensor; - -/** Interface for the dequantization layer kernel. */ -class NEQuantizationSymmetricKernel : public INEKernel -{ -public: - const char *name() const override { return "NEQuantizationSymmetricKernel"; } - /** Default constructor */ - NEQuantizationSymmetricKernel(); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEQuantizationSymmetricKernel(const NEQuantizationSymmetricKernel &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEQuantizationSymmetricKernel &operator=(const NEQuantizationSymmetricKernel &) = delete; - /** Default Move Constructor. */ - NEQuantizationSymmetricKernel(NEQuantizationSymmetricKernel &&) = default; - /** Default move assignment operator */ - NEQuantizationSymmetricKernel &operator=(NEQuantizationSymmetricKernel &&) = default; - /** Default destructor */ - ~NEQuantizationSymmetricKernel() = default; - /** Set input, output tensors. - * - * @param[in] input Source tensor. Data type supported: F16/F32. - * @param[out] output Destination tensor with the same dimensions of input. Data type supported: - * S8. - * @param[out] scale_factor Scale tensor of @p output. Data type supported: Same as @p input. - */ - void configure(const ITensor *input, ITensor *output, ITensor *scale_factor); - /** Static function to check if given info will lead to a valid configuration of @ref - * NEQuantizationSymmetricKernel - * - * @param[in] input Input tensor info. Data types supported: F16/F32. - * @param[in] output Output tensor info. Data types supported: S8. - * @param[out] scale_factor Scale tensor of @p output. Data type supported: Same as @p input. - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, - const ITensorInfo *scale_factor); - - // Inherited methods overridden: - void run(const Window &window, const ThreadInfo &info) override; - -private: - template <typename T> void quantize(const Window &window); - -private: - const ITensor *_input; - ITensor *_output; - ITensor *_scale_factor; -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_NEQUANTIZATIONSYMMETRICKERNEL_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEReductionOperationKernelEx.h b/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEReductionOperationKernelEx.h deleted file mode 100644 index c9024fbb3..000000000 --- a/compute/ARMComputeEx/arm_compute/core/NEON/kernels/NEReductionOperationKernelEx.h +++ /dev/null @@ -1,108 +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. - */ - -/* - * Copyright (c) 2017-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_NEREDUCTIONOPERATIONKERNELEX_H__ -#define __ARM_COMPUTE_NEREDUCTIONOPERATIONKERNELEX_H__ - -#include "arm_compute/core/NEON/INEKernel.h" -#include "arm_compute/core/TypesEx.h" - -namespace arm_compute -{ -class ITensor; - -/** NEON kernel to perform a reduction operation */ -class NEReductionOperationKernelEx : public INEKernel -{ -public: - const char *name() const override { return "NEReductionOperationKernelEx"; } - /** Default constructor */ - NEReductionOperationKernelEx(); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEReductionOperationKernelEx(const NEReductionOperationKernelEx &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEReductionOperationKernelEx &operator=(const NEReductionOperationKernelEx &) = delete; - /** Allow instances of this class to be moved */ - NEReductionOperationKernelEx(NEReductionOperationKernelEx &&) = default; - /** Allow instances of this class to be moved */ - NEReductionOperationKernelEx &operator=(NEReductionOperationKernelEx &&) = default; - /** Default destructor */ - ~NEReductionOperationKernelEx() = default; - - /** Set the source, destination of the kernel - * - * @param[in] input Source tensor. Data type supported: QASYMM8/F16/F32. Data layouts supported: - * NCHW. - * @param[out] output Destination tensor.Data types and data layouts supported: same as @p input. - * Output will have the same number of dimensions as input. - * @param[in] axis Axis along which to reduce. Supported reduction axis : 0 - * @param[in] op Reduction operation to perform. - */ - void configure(const ITensor *input, ITensor *output, unsigned int axis, ReduceOperation op); - - /** Static function to check if given info will lead to a valid configuration of @ref - * NEReductionOperationKernelEx. - * - * @param[in] input Source tensor info. Data type supported: QASYMM8/F16/F32. Data layouts - * supported: NCHW. - * @param[in] output Destination tensor info.Data types and data layouts supported: same as @p - * input. - * Output will have the same number of dimensions as input. - * @param[in] axis Axis along which to reduce. Supported reduction axis : 0 - * @param[in] op Reduction operation to perform. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, unsigned int axis, - ReduceOperation op); - - // Inherited methods overridden: - void run(const Window &window, const ThreadInfo &info) override; - BorderSize border_size() const override; - -private: - const ITensor *_input; - ITensor *_output; - unsigned int _reduction_axis; - ReduceOperation _op; - BorderSize _border_size; -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_NEREDUCTIONOPERATIONKERNELEX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/TypesEx.h b/compute/ARMComputeEx/arm_compute/core/TypesEx.h deleted file mode 100644 index faba8a449..000000000 --- a/compute/ARMComputeEx/arm_compute/core/TypesEx.h +++ /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. - */ - -/* - * 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_TYPESEX_H__ -#define __ARM_COMPUTE_TYPESEX_H__ - -namespace arm_compute -{ - -/** Available ArgIndex operations **/ -enum class ArgOperation -{ - MAX, - MIN, -}; - -/** Available reduce operations */ -enum class ReduceOperation -{ - MAX, /**< Max */ - MEAN, /**< Mean */ - SUM, /**< Sum */ - MIN, /**< Min */ -}; - -/** Available binary logical operations */ -enum class BinaryLogicalOperation -{ - AND, /**< AND */ - OR, /**< OR */ -}; - -enum class ComparisonOperationEx -{ - EQUAL, /**< EQUAL */ - NOT_EQUAL, /**< NOT_EQUAL */ -}; - -enum class ElementWiseUnaryEx -{ - NEG, /**< NEG */ -}; - -enum class SubDataType -{ - NONE, - BOOL, -}; - -} // namespace arm_compute -#endif /* __ARM_COMPUTE_TYPESEX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/UtilsEx.h b/compute/ARMComputeEx/arm_compute/core/UtilsEx.h deleted file mode 100644 index d57e8fcf5..000000000 --- a/compute/ARMComputeEx/arm_compute/core/UtilsEx.h +++ /dev/null @@ -1,71 +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_UTILSEX_H__ -#define __ARM_COMPUTE_UTILSEX_H__ - -#include <utility> - -#include "arm_compute/core/Types.h" - -namespace arm_compute -{ - -/** Returns expected width and height of the transpose convolution's output tensor. - * - * @note This function was copied in order to fix a bug computing to wrong output dimensions. - * - * @param[in] in_width Width of input tensor (Number of columns) - * @param[in] in_height Height of input tensor (Number of rows) - * @param[in] kernel_width Kernel width. - * @param[in] kernel_height Kernel height. - * @param[in] info padding and stride info. - * @param[in] invalid_right The number of zeros added to right edge of the output. - * @param[in] invalid_top The number of zeros added to bottom edge of the output. - * - * @return A pair with the new width in the first position and the new height in the second. - */ -const std::pair<unsigned int, unsigned int> -transposeconv_output_dimensions(unsigned int in_width, unsigned int in_height, - unsigned int kernel_width, unsigned int kernel_height, - const PadStrideInfo &info, unsigned int invalid_right, - unsigned int invalid_top); -} -#endif /*__ARM_COMPUTE_UTILSEX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/core/utils/misc/ShapeCalculatorEx.h b/compute/ARMComputeEx/arm_compute/core/utils/misc/ShapeCalculatorEx.h deleted file mode 100644 index 1e69f0912..000000000 --- a/compute/ARMComputeEx/arm_compute/core/utils/misc/ShapeCalculatorEx.h +++ /dev/null @@ -1,275 +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. - */ - -/* - * 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_MISC_SHAPE_CALCULATOR_EX_H__ -#define __ARM_COMPUTE_MISC_SHAPE_CALCULATOR_EX_H__ - -#include "arm_compute/core/Helpers.h" -#include "arm_compute/core/ITensorInfo.h" -#include "arm_compute/core/Utils.h" - -#include "arm_compute/core/utils/helpers/tensor_transform.h" - -#include <cmath> - -namespace arm_compute -{ -namespace misc -{ -namespace shape_calculator -{ - -/** Calculate the upsampled output shape used for transpose convolution - * - * @param[in] input Input tensor info - * @param[in] weights Weights tensor shape - * @param[in] info Padding and stride info - * @param[in] out_dims Output shape dimensions - * @param[in] invalid_right The number of zeros added to right edge of the output. - * @param[in] invalid_bottom The number of zeros added to bottom edge of the output. - * @param[out] pad_left Padding on left - * @param[out] pad_right Padding on right - * @param[out] pad_top Padding on top - * @param[out] pad_bottom Padding on bottom - * - * @return the calculated shape - */ -inline TensorShape compute_transposeconv_upsampled_shape( - const ITensorInfo &input, const ITensorInfo &weights, const PadStrideInfo &info, - std::pair<unsigned int, unsigned int> &out_dims, unsigned int invalid_right, - unsigned int invalid_bottom, unsigned int &pad_left, unsigned int &pad_right, - unsigned int &pad_top, unsigned int &pad_bottom) -{ - unsigned int sx = info.stride().first; - unsigned int sy = info.stride().second; - const DataLayout data_layout = input.data_layout(); - const size_t idx_w = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH); - const size_t idx_h = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT); - - // Find the upsampled dimensions - // transpose conv out: - // tconv_out + pad = 1 + (in - 1) * stride + invalid - // tconv_out = 1 + (in - 1) * stride + invalid - pad - // upsample out: - // upsample_out = 1 + (in - 1) * stride - unsigned int out_x = (input.dimension(idx_w) - 1) * sx + 1; - unsigned int out_y = (input.dimension(idx_h) - 1) * sy + 1; - - // Find the padding needed for the convolution with stride 1 in order to match output shape - // upsample+pad out: - // upsample_out + pad = tconv_out + kernel - 1 - // pad = tconv_out + kernel - 1 - upsample_out - unsigned int padx = out_dims.first - (out_x - weights.dimension(idx_w) + 1); - unsigned int pady = out_dims.second - (out_y - weights.dimension(idx_h) + 1); - out_x += padx; - out_y += pady; - - unsigned int padx_all_except_invallid = padx + info.pad_left() + info.pad_right() - invalid_right; - unsigned int pady_all_except_invallid = - pady + info.pad_top() + info.pad_bottom() - invalid_bottom; - pad_left = (padx_all_except_invallid + 1) / 2 - info.pad_left(); - pad_right = pady_all_except_invallid / 2 - info.pad_right() + invalid_right; - pad_top = (padx_all_except_invallid + 1) / 2 - info.pad_top(); - pad_bottom = pady_all_except_invallid / 2 - info.pad_bottom() + invalid_bottom; - - TensorShape scale_out_shape(input.tensor_shape()); - scale_out_shape.set(idx_w, out_x); - scale_out_shape.set(idx_h, out_y); - - return scale_out_shape; -} - -/** Calculate the output shape of the transpose convolution layer - * - * @param[in] out_dims Output x and y shape dimensions - * @param[in] input Input tensor info - * @param[in] weights Weights tensor shape - * - * @return the calculated shape - */ -inline TensorShape -compute_transposeconv_output_shape(const std::pair<unsigned int, unsigned int> &out_dims, - const ITensorInfo &input, const ITensorInfo &weights) -{ - const TensorShape input_shape{input.tensor_shape()}; - const TensorShape weights_shape{weights.tensor_shape()}; - - const DataLayout data_layout = input.data_layout(); - const int width_idx = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH); - const int height_idx = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT); - const int channel_idx = - get_data_layout_dimension_index(data_layout, DataLayoutDimension::CHANNEL); - const int batch_idx = get_data_layout_dimension_index(data_layout, DataLayoutDimension::BATCHES); - - TensorShape out_shape{input_shape}; - out_shape.set(width_idx, out_dims.first); - out_shape.set(height_idx, out_dims.second); - out_shape.set(channel_idx, weights_shape[batch_idx]); - return out_shape; -} - -/** Calculate the depth to space output shape of a tensor - * - * @param[in] input Input tensor info - * @param[in] block Block shape value - * - * @return the calculated shape - */ -inline TensorShape compute_depth_to_space_shape_ex(const ITensorInfo *input, int block) -{ - ARM_COMPUTE_ERROR_ON(block < 2); - - const DataLayout data_layout = input->data_layout(); - const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH); - const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT); - const int idx_channel = - get_data_layout_dimension_index(data_layout, DataLayoutDimension::CHANNEL); - - TensorShape output_shape{input->tensor_shape()}; - output_shape.set(idx_width, input->dimension(idx_width) * block); - output_shape.set(idx_height, input->dimension(idx_height) * block); - output_shape.set(idx_channel, input->dimension(idx_channel) / (block * block)); - - return output_shape; -} - -/** Calculate the space to batch output shape of a tensor - * - * @param[in] input Input tensor info - * @param[in] block_shape Block shape value - * - * @return the calculated shape - */ -inline TensorShape compute_space_to_depth_shape_ex(const ITensorInfo *input, int32_t block_shape) -{ - ARM_COMPUTE_ERROR_ON(block_shape < 2); - TensorShape output_shape{input->tensor_shape()}; - - const DataLayout data_layout = input->data_layout(); - const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH); - const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT); - const int idx_depth = get_data_layout_dimension_index(data_layout, DataLayoutDimension::CHANNEL); - - output_shape.set(idx_width, input->tensor_shape()[idx_width] * block_shape); - output_shape.set(idx_height, input->tensor_shape()[idx_height] * block_shape); - output_shape.set(idx_depth, input->tensor_shape()[idx_depth] / (block_shape * block_shape)); - - return output_shape; -} - -/** Calculate the gather output shape of a tensor - * - * @param[in] input_shape Input tensor shape - * @param[in] indices_shape Indices tensor shape - * @param[in] actual_axis The axis to be gathered - * - * @return the calculated shape - */ -inline TensorShape compute_gather_shape_ex(const TensorShape &input_shape, - const TensorShape &indices_shape, uint32_t actual_axis) -{ - ARM_COMPUTE_ERROR_ON(indices_shape.num_dimensions() > 3); - ARM_COMPUTE_ERROR_ON(input_shape.num_dimensions() > 4); - ARM_COMPUTE_ERROR_ON(input_shape.num_dimensions() + indices_shape.num_dimensions() - 1 > 4); - ARM_COMPUTE_ERROR_ON(actual_axis >= input_shape.num_dimensions()); - - TensorShape output_shape = input_shape; - if (indices_shape.num_dimensions() == 1) - { - output_shape[actual_axis] = indices_shape[0]; - } - else if (indices_shape.num_dimensions() > 1) - { - output_shape.shift_right(indices_shape.num_dimensions() - 1); - - for (uint32_t i = 0, o = 0; o < output_shape.num_dimensions(); ++o, ++i) - { - if (o == actual_axis) - { - ++i; - for (uint32_t in = 0; in < indices_shape.num_dimensions(); ++in, ++o) - { - output_shape[o] = indices_shape[in]; - } - } - else - { - output_shape[o] = input_shape[i]; - } - } - } - return output_shape; -} - -/** Calculate the gather output shape of a tensor - * - * @param[in] input_shape Input tensor shape - * @param[in] indices_shape Indices tensor shape - * @param[in] actual_axis The axis to be gathered - * - * @return the calculated shape - */ -inline TensorShape compute_onehot_shape_ex(const TensorShape &indices_shape, uint32_t depth, - uint32_t actual_axis) -{ - ARM_COMPUTE_ERROR_ON(indices_shape.num_dimensions() > 3); - ARM_COMPUTE_ERROR_ON(actual_axis > indices_shape.num_dimensions()); - - TensorShape output_shape; - output_shape.set(actual_axis, depth); - - unsigned int i_shift = 0; - for (unsigned int i = 0; i < indices_shape.num_dimensions(); ++i) - { - if (i == actual_axis) - { - i_shift++; - } - output_shape.set(i + i_shift, indices_shape[i]); - } - - return output_shape; -} - -} // namespace shape_calculator -} // namespace misc -} // namespace arm_compute - -#endif // __ARM_COMPUTE_MISC_SHAPE_CALCULATOR_EX_H__ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/CLFunctionsEx.h b/compute/ARMComputeEx/arm_compute/runtime/CL/CLFunctionsEx.h deleted file mode 100644 index 484ebfd0b..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/CLFunctionsEx.h +++ /dev/null @@ -1,34 +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. - */ -#ifndef __ARM_COMPUTE_CLFUNCTIONSEX_H__ -#define __ARM_COMPUTE_CLFUNCTIONSEX_H__ - -#include <arm_compute/runtime/CL/functions/CLArgMinMaxLayerEx.h> -#include <arm_compute/runtime/CL/functions/CLBinaryLogicalOp.h> -#include <arm_compute/runtime/CL/functions/CLCastBool.h> -#include <arm_compute/runtime/CL/functions/CLEmbeddingLookup.h> -#include <arm_compute/runtime/CL/functions/CLFullyConnectedReshapingLayer.h> -#include <arm_compute/runtime/CL/functions/CLGatherEx.h> -#include <arm_compute/runtime/CL/functions/CLHashtableLookup.h> -#include <arm_compute/runtime/CL/functions/CLInstanceNormalizationLayerEx.h> -#include <arm_compute/runtime/CL/functions/CLNeg.h> -#include <arm_compute/runtime/CL/functions/CLOneHot.h> -#include <arm_compute/runtime/CL/functions/CLReduceOperation.h> -#include <arm_compute/runtime/CL/functions/CLSplitVEx.h> -#include <arm_compute/runtime/CL/functions/CLTopKV2.h> -#include <arm_compute/runtime/CL/functions/CLTransposeConvLayer.h> - -#endif // __ARM_COMPUTE_CLFUNCTIONSEX_H__ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLArgMinMaxLayerEx.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLArgMinMaxLayerEx.h deleted file mode 100644 index b1ee52bf9..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLArgMinMaxLayerEx.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2020 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) 2018-2019 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_CLARGMINMAXLAYEREX_H__ -#define __ARM_COMPUTE_CLARGMINMAXLAYEREX_H__ - -#include "arm_compute/core/CL/kernels/CLArgMinMaxLayerKernelEx.h" -#include "arm_compute/core/CL/kernels/CLReshapeLayerKernel.h" -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/IFunction.h" -#include "arm_compute/runtime/IMemoryManager.h" -#include "arm_compute/runtime/MemoryGroup.h" - -namespace arm_compute -{ -class ITensorInfo; -class ICLTensor; - -/** Function to calculate the index of the minimum or maximum values in a - * tensor based on an axis. - * - * @note The default data type for an uninitialized output tensor is - * signed 32-bit integer (S32). It is the user's responsibility to check - * that the results do not overflow because the indices are computed - * in unsigned 32-bit (U32). - */ -class CLArgMinMaxLayerEx : public IFunction -{ -public: - /** Default Constructor. - * - * @param[in] memory_manager (Optional) Memory manager. - */ - CLArgMinMaxLayerEx(std::shared_ptr<IMemoryManager> memory_manager = nullptr); - /** Set the input and output tensors. - * - * @param[in] input Input source tensor. Data types supported: QASYMM8/F16/F32. - * @param[in] axis Axis to find max/min index. - * @param[out] output Output source tensor. Data types supported: U32/S32. - * @param[in] op Reduction operation to perform. Operations supported: ARG_IDX_MAX, - * ARG_IDX_MIN - */ - void configure(const ICLTensor *input, int axis, ICLTensor *output, const ReductionOperation &op); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLArgMinMaxLayerEx - * - * @param[in] input Input source tensor info. Data types supported: QASYMM8/F16/F32. - * @param[in] axis Axis to find max/min index. - * @param[in] output Output source tensor info. Data types supported: U32/S32. - * @param[in] op Reduction operation to perform. Operations supported: ARG_IDX_MAX, - * ARG_IDX_MIN - * - * @return a status - */ - static Status validate(const ITensorInfo *input, int axis, const ITensorInfo *output, - const ReductionOperation &op); - - // Inherited methods overridden: - void run() override; - -private: - MemoryGroup _memory_group; - std::vector<CLTensor> _results_vector; - CLTensor _not_reshaped_output; - std::vector<CLArgMinMaxLayerKernelEx> _reduction_kernels_vector; - CLReshapeLayerKernel _reshape_kernel; - unsigned int _num_of_stages; - unsigned int _reduction_axis; -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_CLARGMINMAXLAYEREX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLBinaryLogicalOp.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLBinaryLogicalOp.h deleted file mode 100644 index 88a9b00ec..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLBinaryLogicalOp.h +++ /dev/null @@ -1,65 +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_CLBINARYLOGICALOP_H__ -#define __ARM_COMPUTE_CLBINARYLOGICALOP_H__ - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" -#include "arm_compute/core/TypesEx.h" - -namespace arm_compute -{ -class ICLTensor; - -class CLBinaryLogicalOp : public ICLSimpleFunction -{ -public: - /** Initialise the function's source and destination. - * - * @param[in] input1 Source tensor1. Data types supported: U8, QASYMM8. - * @param[in] input2 Source tensor2. Data types supported: U8 QASYMM8. - * @param[out] output Output tensor. Data types supported: U8, QASYMM8. - */ - void configure(ICLTensor *input1, ICLTensor *input2, ICLTensor *output, - BinaryLogicalOperation op); -}; - -} // namespace arm_compute -#endif /*__ARM_COMPUTE_CLBINARYLOGICALOP_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLCastBool.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLCastBool.h deleted file mode 100644 index d6150684a..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLCastBool.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2020 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. - */ - -/** - * @file CLCastBool.h - * @ingroup COM_AI_RUNTIME - * @brief This file contains arm_compute::CLCastBool class - */ - -#ifndef ARM_COMPUTE_CLCASTBOOL_H -#define ARM_COMPUTE_CLCASTBOOL_H - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -namespace arm_compute -{ -class ICLTensor; - -/** - * @brief Class to run @ref CLCastBoolKernel. - * This converts the boolean input tensor to the output tensor's type. - */ -class CLCastBool : public ICLSimpleFunction -{ -public: - /** - * @brief Initialise the kernel's input and output - * @param[in] input Input tensor. Data types supported: U8 - * @param[out] output Output tensor. Data types supported: U8/S8/U16/S16/U32/F16/F32. - */ - void configure(ICLTensor *input, ICLTensor *output); -}; -} -#endif /* ARM_COMPUTE_CLCASTBOOL_H */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLDirectTransposeConvLayer.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLDirectTransposeConvLayer.h deleted file mode 100644 index 409eaf593..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLDirectTransposeConvLayer.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (c) 2020 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) 2019-2020 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_CLDIRECTTRANSPOSECONVLAYER_H__ -#define __ARM_COMPUTE_CLDIRECTTRANSPOSECONVLAYER_H__ - -#include "arm_compute/runtime/CL/functions/CLConvolutionLayer.h" -#include "arm_compute/runtime/CL/functions/CLDeconvolutionLayerUpsample.h" -#include "arm_compute/runtime/CL/functions/CLReverse.h" -#include "arm_compute/runtime/CL/functions/CLTranspose.h" - -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/IFunction.h" -#include "arm_compute/runtime/IMemoryManager.h" -#include "arm_compute/runtime/MemoryGroup.h" - -#include <memory> - -namespace arm_compute -{ -class ICLTensor; -/** Function to run the deconvolution layer. - * - * Deconvolution Layer is the backward pass of Convolution Layer. First we transform the input - * depending on the stride and pad info and then perform a 1x1 - * convolution pass. Input stride defines how many zeroes we should put between each element of the - * input and pad is the amount of padding. - * - * The relation between input to output is as follows: - * \f[ - * width\_output = (width\_input - 1) \cdot stride\_x - 2 \cdot padding\_x + kernel\_x - * \f] - * \f[ - * height\_output = (height\_input - 1) \cdot stride\_y - 2 \cdot padding\_y + kernel\_y - * \f] - * - * where: - * width_input is the size of the first input dimension. - * height_input is the size of the second input dimension. - * width_output is the size of the first output dimension. - * height_output is the size of the second output dimension. - * kernel_x and kernel_y are the convolution sizes in x and y. - * stride_x and stride_y is the input stride of the first and second dimension. - * - * The weights used by Deconvolution are supposed to be the same as the ones used for Convolution. - * Therefore, it will be necessary to use the weights in the - * reverse order to perform an actual convolution. This is achieved by using @ref CLReverse. - * - * This function calls the following OpenCL kernels/functions: - * - * -# @ref CLDeconvolutionLayerUpsample - * -# @ref CLConvolutionLayer - * - * And the following CPP kernels: - * -# @ref CLReverse - * - */ -class CLDirectTransposeConvLayer : public IFunction -{ -public: - /** Constructor */ - CLDirectTransposeConvLayer(std::shared_ptr<IMemoryManager> memory_manager = nullptr); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLDirectTransposeConvLayer(const CLDirectTransposeConvLayer &) = delete; - /** Default move constructor */ - CLDirectTransposeConvLayer(CLDirectTransposeConvLayer &&) = default; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLDirectTransposeConvLayer &operator=(const CLDirectTransposeConvLayer &) = delete; - /** Default move assignment operator */ - CLDirectTransposeConvLayer &operator=(CLDirectTransposeConvLayer &&) = default; - /** Set the input, weights, biases and output tensors. - * - * @param[in,out] input Input tensor. 3 lower dimensions represent a single input, and an - * optional 4th dimension for batch of inputs. - * Data types supported: QASYMM8_SIGNED/QASYMM8/F16/F32. - * @param[in] weights The 4d weights with dimensions [width, height, IFM, OFM]. Data type - * supported: Same as @p input. - * @param[in] bias (Optional) The biases have one dimension. - * Data type supported: Should match @p input data type, except for - * input of QASYMM8 and QASYMM8_SIGNED type where biases should be of S32 type - * @param[out] output Output tensor. The output has the same number of dimensions as the - * @p input. - * @param[in] info Contains padding and policies to be used in the deconvolution, this - * is decribed in @ref PadStrideInfo. - * @param[in] invalid_right The number of zeros added to right edge of the output. - * @param[in] invalid_bottom The number of zeros added to bottom edge of the output. - * @param[in] weights_info (Optional) Weights information needed for @ref CLConvolutionLayer, - * specifies if the weights tensor has been reshaped with @ref CLWeightsReshapeKernel. - * - */ - void configure(ICLTensor *input, ICLTensor *weights, const ICLTensor *bias, ICLTensor *output, - const PadStrideInfo &info, unsigned int invalid_right, unsigned int invalid_bottom, - const WeightsInfo &weights_info = WeightsInfo()); - /** Set the input, weights, biases and output tensors. - * - * @param[in] compile_context The compile context to be used. - * @param[in,out] input Input tensor. 3 lower dimensions represent a single input, and - * an optional 4th dimension for batch of inputs. - * Data types supported: QASYMM8_SIGNED/QASYMM8/F16/F32. - * @param[in] weights The 4d weights with dimensions [width, height, IFM, OFM]. Data - * type supported: Same as @p input. - * @param[in] bias (Optional) The biases have one dimension. - * Data type supported: Should match @p input data type, except for - * input of QASYMM8 and QASYMM8_SIGNED type where biases should be of S32 type - * @param[out] output Output tensor. The output has the same number of dimensions as - * the @p input. - * @param[in] info Contains padding and policies to be used in the deconvolution, - * this is decribed in @ref PadStrideInfo. - * @param[in] invalid_right The number of zeros added to right edge of the output. - * @param[in] invalid_bottom The number of zeros added to bottom edge of the output. - * @param[in] weights_info (Optional) Weights information needed for @ref - * CLConvolutionLayer, specifies if the weights tensor has been reshaped with @ref - * CLWeightsReshapeKernel. - * - */ - void configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *weights, - const ICLTensor *bias, ICLTensor *output, const PadStrideInfo &info, - unsigned int invalid_right, unsigned int invalid_bottom, - const WeightsInfo &weights_info = WeightsInfo()); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLDirectTransposeConvLayer - * - * @param[in] input Input tensor info. 3 lower dimensions represent a single input, and an - * optional 4th dimension for batch of inputs. - * Data types supported: QASYMM8_SIGNED/QASYMM8/F16/F32. - * @param[in] weights The 4d weights info with dimensions [width, height, IFM, OFM]. Data - * type supported: Same as @p input. - * @param[in] bias (Optional) The biases have one dimension. - * Data type supported: Should match @p input data type, except for input - * of QASYMM8 and QASYMM8_SIGNED type where biases should be of S32 type - * @param[in] output Output tensor info. The output has the same number of dimensions as the - * @p input. - * @param[in] info Contains padding and policies to be used in the deconvolution, this is - * decribed in @ref PadStrideInfo. - * @param[in] invalid_right The number of zeros added to right edge of the output. - * @param[in] invalid_bottom The number of zeros added to bottom edge of the output. - * @param[in] weights_info (Optional) Weights information needed for @ref CLConvolutionLayer, - * specifies if the weights tensor has been reshaped with @ref CLWeightsReshapeKernel. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *weights, - const ITensorInfo *bias, ITensorInfo *output, const PadStrideInfo &info, - unsigned int invalid_right, unsigned int invalid_bottom, - const WeightsInfo &weights_info = WeightsInfo()); - - // Inherited methods overridden: - void run() override; - void prepare() override; - -private: - MemoryGroup _memory_group; - CLDeconvolutionLayerUpsample _scale_f; - CLConvolutionLayer _conv_f; - CLReverse _flip_weights; - - CLTensor _scaled_output; - ICLTensor *_original_weights; - CLTensor _weights_flipped; - CLTensor _flip_axis; - - bool _is_prepared; -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_CLDIRECTTRANSPOSECONVLAYER_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLEmbeddingLookup.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLEmbeddingLookup.h deleted file mode 100644 index fbee7e40e..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLEmbeddingLookup.h +++ /dev/null @@ -1,77 +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. - */ - -/** - * @file CLEmbeddingLookup.h - * @ingroup COM_AI_RUNTIME - * @brief This file contains arm_compute::CLEmbeddingLookup class - */ - -#ifndef __ARM_COMPUTE_CLEMBEDDINGLOOKUP_H__ -#define __ARM_COMPUTE_CLEMBEDDINGLOOKUP_H__ - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -#include <vector> - -namespace arm_compute -{ -class ICLTensor; - -/** - * @brief Class to perform EmbeddingLookup operation - */ -class CLEmbeddingLookup : public ICLSimpleFunction -{ -public: - /** - * @brief Set the input and output tensors. - * @param[in] input Source tensor. - * Data types supported: U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32 - * @param[out] output Destination tensor. Data types and data layouts supported: Same as @p - * input. - * @param[in] lookups Lookups 1D tensor that values are indices into the first dimension of - * input. - * @return N/A - */ - void configure(const ICLTensor *input, ICLTensor *output, const ICLTensor *lookups); -}; -} -#endif /*__ARM_COMPUTE_CLEMBEDDINGLOOKUP_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedHybridLayer.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedHybridLayer.h deleted file mode 100644 index f3266f688..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedHybridLayer.h +++ /dev/null @@ -1,186 +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. - */ - -/* - * Copyright (c) 2017-2019 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_CLFULLYCONNECTEDHYBRIDLAYER_H__ -#define __ARM_COMPUTE_CLFULLYCONNECTEDHYBRIDLAYER_H__ - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -#include "arm_compute/core/CL/kernels/CLGEMMMatrixAccumulateBiasesKernel.h" -#include "arm_compute/core/CL/kernels/CLMultiplyScaleFactorKernel.h" -#include "arm_compute/core/CL/kernels/CLQuantizationSymmetricKernel.h" -#include "arm_compute/core/CL/kernels/CLScaleFactorSymm8Kernel.h" -#include "arm_compute/core/CL/kernels/CLTransposeKernel.h" -#include "arm_compute/runtime/MemoryGroup.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.h" - -namespace arm_compute -{ -/** Basic function to reshape the weights of Fully Connected layer with OpenCL. This function calls - * the following kernels: - * - * -# @ref CLTransposeKernel - * - * @note The fully connected layer accepts "weights" tensors only with 2 dimensions. - */ -class CLFullyConnectedHybridLayerReshapeWeights : public ICLSimpleFunction -{ -public: - /** Set the input and output tensors. - * - * @param[in] input Weights tensor. The weights must be 2 dimensional. Data types supported: - * S8. - * @param[out] output Destination tensor which stores the transposed input tensor. Data type - * supported: Same as @p input. - */ - void configure(const ICLTensor *input, ICLTensor *output); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLFullyConnectedHybridLayerReshapeWeights - * - * @param[in] input Weights tensor. The weights must be 2 dimensional. Data types supported: - * S8. - * @param[in] output Destination tensor which stores the transposed input tensor. Data type - * supported: Same as @p input. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output); -}; - -/** Basic function to compute a Fully Connected layer on OpenCL. This function calls the following - * OpenCL kernels: - * - * -# @ref CLIm2ColKernel (called when the input comes from a convolutional layer) - * -# @ref CLFullyConnectedHybridLayerReshapeWeights (if @p are_weights_reshaped is set to false - * and transpose_weights is set to true ) (called once) - * -# @ref CLGEMMLowpMatrixMultiplyCore (if quantized symmetric) - * -# @ref CLGEMMMatrixAccumulateBiasesKernel (if @p biases is not equal to nullptr) - * - * @note The fully connected layer accepts "weights" tensors only with 2 dimensions. - */ -class CLFullyConnectedHybridLayer : public IFunction -{ -public: - /** Constructor */ - CLFullyConnectedHybridLayer(std::shared_ptr<IMemoryManager> memory_manager = nullptr); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLFullyConnectedHybridLayer(const CLFullyConnectedHybridLayer &) = delete; - /** Default move constructor */ - CLFullyConnectedHybridLayer(CLFullyConnectedHybridLayer &&) = default; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLFullyConnectedHybridLayer &operator=(const CLFullyConnectedHybridLayer &) = delete; - /** Default move assignment operator */ - CLFullyConnectedHybridLayer &operator=(CLFullyConnectedHybridLayer &&) = default; - /** Set the input and output tensors. - * - * @param[in] input Source tensor. Data type supported: F16/F32. - * @param[in] weights Weights tensor. The weights must be 2 dimensional. - * If this function is called after a Convolution Layer, the (transposed) - * weights will have as many rows as the product of the first 3 input's dimensions. - * If it is called after another FullyConnected Layer, the (transposed) - * weights will have as many rows as the input's first dimension. - * Data type supported: S8. - * @param[in] biases Bias tensor. Can be nullptr. Data type supported:Same as @p input. - * @param[out] output Destination tensor. Its shape should be equal to the output of a matrix - * multiplication between: - * - The output of im2col on the input and the (transposed) 2D weights, if the - * function is called after a Convolution Layer - * - The input tensor and the (transposed) 2D weights, if the function is - * called after another FullyConnected Layer. - * Data type supported: Same as @p input. - * @param[in] fc_info (Optional) Fully connected layer additional info - */ - void configure(const ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, - ICLTensor *output, FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo()); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLFullyConnectedHybridLayer - * - * @param[in] input Source tensor info. Data type supported: F16/F32. - * @param[in] weights Weights tensor info. The weights must be 2 dimensional. - * If this function is called after a Convolution Layer, the (transposed) - * weights will have as many rows as the product of the first 3 input's dimensions. - * If it is called after another FullyConnected Layer, the (transposed) - * weights will have as many rows as the input's first dimension. - * Data type supported: S8. - * @param[in] biases Bias tensor info. Can be nullptr. Data type supported:Same as @p input. - * @param[out] output Destination tensor info. Its shape should be equal to the output of a - * matrix multiplication between: - * - The output of im2col on the input and the (transposed) 2D weights, if the - * function is called after a Convolution Layer - * - The input tensor and the (transposed) 2D weights, if the function is - * called after another FullyConnected Layer. - * Data type supported: Same as @p input. - * @param[in] fc_info (Optional) Fully connected layer additional info - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *weights, - const ITensorInfo *biases, const ITensorInfo *output, - FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo()); - - // Inherited methods override - void run() override; - void prepare() override; - -private: - void configure_mm(const ICLTensor *input, const ICLTensor *weights, ICLTensor *output, - bool retain_internal_weights); - - MemoryGroup _memory_group; - CLFullyConnectedHybridLayerReshapeWeights _reshape_weights_kernel; - CLScaleFactorSymm8Kernel _scale_factor_kernel; - CLQuantizationSymmetricKernel _quant_input_kernel; - CLGEMMLowpMatrixMultiplyCore _mm_gemmlowp; - CLMultiplyScaleFactorKernel _multiply_scale_kernel; - CLGEMMMatrixAccumulateBiasesKernel _accumulate_biases_kernel; // TODO(COMPMID-1889): Use CLGEMM to - // add bias in - // CLFullyConnectedHybridLayer - CLTensor _reshape_weights_output; - CLTensor _quantized_input; - CLTensor _scale_factor; - CLTensor _gemmlowp_output; - bool _are_weights_reshaped; - bool _accumulate_biases; - bool _is_prepared; - const ICLTensor *_original_weights; -}; -} -#endif /* __ARM_COMPUTE_CLFULLYCONNECTEDHYBRIDLAYER_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedLayerEx.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedLayerEx.h deleted file mode 100644 index e65a646dc..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedLayerEx.h +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (c) 2020 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) 2017-2019 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_CLFULLYCONNECTEDLAYEREX_H__ -#define __ARM_COMPUTE_CLFULLYCONNECTEDLAYEREX_H__ - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -#include "arm_compute/core/CL/kernels/CLGEMMMatrixAccumulateBiasesKernel.h" -#include "arm_compute/core/CL/kernels/CLTransposeKernel.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/functions/CLConvertFullyConnectedWeights.h" -#include "arm_compute/runtime/CL/functions/CLFlattenLayer.h" -#include "arm_compute/runtime/CL/functions/CLGEMM.h" -#include "arm_compute/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.h" -#include "arm_compute/runtime/CL/functions/CLGEMMLowpOutputStage.h" -#include "arm_compute/runtime/IWeightsManager.h" -#include "arm_compute/runtime/MemoryGroup.h" - -namespace arm_compute -{ -/** Basic function to reshape the weights of Fully Connected layer with OpenCL. This function calls - * the following kernels: - * - * -# @ref CLTransposeKernel - * - * @note The fully connected layer accepts "weights" tensors only with 2 dimensions. - */ -class CLFullyConnectedLayerReshapeWeightsEx : public ICLSimpleFunction -{ -public: - /** Set the input and output tensors. - * - * @param[in] input Weights tensor. The weights must be 2 dimensional. Data types supported: - * QASYMM8/F16/F32. - * @param[out] output Destination tensor which stores the transposed input tensor. Data type - * supported: Same as @p input. - */ - void configure(const ICLTensor *input, ICLTensor *output); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLFullyConnectedLayerReshapeWeightsEx - * - * @param[in] input Weights tensor. The weights must be 2 dimensional. Data types supported: - * QASYMM8/F16/F32. - * @param[in] output Destination tensor which stores the transposed input tensor. Data type - * supported: Same as @p input. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output); -}; - -namespace weights_transformations -{ -/** Basic function to manage the reshape weights generated from @ref - * CLFullyConnectedLayerReshapeWeightsEx */ -class CLFullyConnectedLayerReshapeWeightsExManaged : public ITransformWeights -{ -public: - // Inherited method override - void run() override - { - _output.allocator()->allocate(); - _func.run(); - _reshape_run = true; - } - - // Inherited method override - void release() override { _output.allocator()->free(); } - - // Inherited method override - ICLTensor *get_weights() override { return &_output; } - - // Inherited method override - uint32_t uid() override { return _uid; } - - /** Configures the @ref CLFullyConnectedLayerReshapeWeightsEx function - * - * @param[in] input Source tensor. Data type supported: QASYMM8/F16/F32. - */ - void configure(const ICLTensor *input) { _func.configure(input, &_output); } - -private: - static constexpr uint32_t _uid = 0x0; - CLTensor _output{}; - CLFullyConnectedLayerReshapeWeightsEx _func{}; -}; -} // namespace weights_transformations - -/** Basic function to compute a Fully Connected layer on OpenCL. This function calls the following - * OpenCL kernels: - * - * -# @ref CLIm2ColKernel (called when the input comes from a convolutional layer) - * -# @ref CLFullyConnectedLayerReshapeWeightsEx (if @p are_weights_reshaped is set to false and - * transpose_weights is set to true ) (called once) - * -# @ref CLGEMMMatrixMultiplyKernel or @ref CLGEMMLowpMatrixMultiplyCore (if quantized - * asymmetric) - * -# @ref CLGEMMMatrixAccumulateBiasesKernel or @ref - * CLGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPoint (if quantized asymmetric) (if @p biases is - * not equal to nullptr) - * - * @note The fully connected layer accepts "weights" tensors only with 2 dimensions. - */ -class CLFullyConnectedLayerEx : public IFunction -{ -public: - /** Constructor */ - CLFullyConnectedLayerEx(std::shared_ptr<IMemoryManager> memory_manager = nullptr, - IWeightsManager *weights_manager = nullptr); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLFullyConnectedLayerEx(const CLFullyConnectedLayerEx &) = delete; - /** Default move constructor */ - CLFullyConnectedLayerEx(CLFullyConnectedLayerEx &&) = default; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLFullyConnectedLayerEx &operator=(const CLFullyConnectedLayerEx &) = delete; - /** Default move assignment operator */ - CLFullyConnectedLayerEx &operator=(CLFullyConnectedLayerEx &&) = default; - /** Set the input and output tensors. - * - * @param[in] input Source tensor. Data type supported: QASYMM8/F16/F32. - * @param[in] weights Weights tensor. The weights must be 2 dimensional. - * If this function is called after a Convolution Layer, the (transposed) - * weights will have as many rows as the product of the first 3 input's dimensions. - * If it is called after another FullyConnected Layer, the (transposed) - * weights will have as many rows as the input's first dimension. - * Data type supported: Same as @p input. - * @param[in] biases Bias tensor. Can be nullptr. Data type supported:Same as @p input. - * @param[out] output Destination tensor. Its shape should be equal to the output of a matrix - * multiplication between: - * - The output of im2col on the input and the (transposed) 2D weights, if the - * function is called after a Convolution Layer - * - The input tensor and the (transposed) 2D weights, if the function is - * called after another FullyConnected Layer. - * Data type supported: Same as @p input. - * @param[in] fc_info (Optional) Fully connected layer additional info - */ - void configure(const ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, - ICLTensor *output, FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo()); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLFullyConnectedLayerEx - * - * @param[in] input Source tensor info. Data type supported: QASYMM8/F16/F32. - * @param[in] weights Weights tensor info. The weights must be 2 dimensional. - * If this function is called after a Convolution Layer, the (transposed) - * weights will have as many rows as the product of the first 3 input's dimensions. - * If it is called after another FullyConnected Layer, the (transposed) - * weights will have as many rows as the input's first dimension. - * Data type supported: Same as @p input. - * @param[in] biases Bias tensor info. Can be nullptr. Data type supported:Same as @p input. - * @param[out] output Destination tensor info. Its shape should be equal to the output of a - * matrix multiplication between: - * - The output of im2col on the input and the (transposed) 2D weights, if the - * function is called after a Convolution Layer - * - The input tensor and the (transposed) 2D weights, if the function is - * called after another FullyConnected Layer. - * Data type supported: Same as @p input. - * @param[in] fc_info (Optional) Fully connected layer additional info - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *weights, - const ITensorInfo *biases, const ITensorInfo *output, - FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo()); - - // Inherited methods override - void run() override; - void prepare() override; - -private: - void configure_fc_fc(const ICLTensor *input, const ICLTensor *weights, const ICLTensor *bias, - ICLTensor *output, const FullyConnectedLayerInfo &fc_info); - void configure_conv_fc(const ICLTensor *input, const ICLTensor *weights, const ICLTensor *bias, - ICLTensor *output, const FullyConnectedLayerInfo &fc_info); - void configure_mm(const ICLTensor *input, const ICLTensor *weights, const ICLTensor *bias, - ICLTensor *output, const FullyConnectedLayerInfo &fc_info); - - MemoryGroup _memory_group; - IWeightsManager *_weights_manager; - CLConvertFullyConnectedWeights _convert_weights; - weights_transformations::CLConvertFullyConnectedWeightsManaged _convert_weights_managed; - weights_transformations::CLFullyConnectedLayerReshapeWeightsExManaged - _reshape_weights_managed_function; - CLFlattenLayer _flatten_layer; - CLFullyConnectedLayerReshapeWeightsEx _reshape_weights_function; - CLGEMM _mm_gemm; - CLGEMMLowpMatrixMultiplyCore _mm_gemmlowp; - CLTensor _flatten_output; - CLTensor _converted_weights_output; - CLTensor _reshape_weights_output; - bool _are_weights_converted; - bool _are_weights_reshaped; - bool _is_fc_after_conv; - bool _is_quantized; - bool _is_prepared; - const ICLTensor *_original_weights; -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_CLFULLYCONNECTEDLAYEREX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedReshapingLayer.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedReshapingLayer.h deleted file mode 100644 index 289ab167f..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedReshapingLayer.h +++ /dev/null @@ -1,97 +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       CLFullyConnectedReshapingLayer.h - * @brief      This file contains CLFullyConnectedReshapingLayer class - * @ingroup    COM_AI_RUNTIME - */ - -#ifndef __ARM_COMPUTE_CL_FULLY_CONNECTED_RESHAPING_LAYER_H__ -#define __ARM_COMPUTE_CL_FULLY_CONNECTED_RESHAPING_LAYER_H__ - -#include <arm_compute/runtime/CL/CLTensor.h> -#include <arm_compute/runtime/CL/functions/CLReshapeLayer.h> -#include <arm_compute/runtime/IMemoryManager.h> - -namespace arm_compute -{ -/** - * @brief Class to run FullyConnected Layer after reshaping input tensor - */ -class CLFullyConnectedReshapingLayer : public arm_compute::IFunction -{ -public: - enum class KernelType - { - GENERAL, //< General FC - PREPROCESSED_WEIGHTS //< Weights are constants so it can be preprocessed - }; - -public: - CLFullyConnectedReshapingLayer(std::shared_ptr<IMemoryManager> memory_manager = nullptr) - : _input(nullptr), _weights(nullptr), _biases(nullptr), _output(nullptr), _cl_buffer{}, - _memory_manager{memory_manager}, _cl_fc{nullptr}, _cl_reshape{}, _needs_reshape(false) - { - // DO NOTHING - } - -public: - /** - * @brief Configure the layer - * @param[in] input The source tensor - * @param[in] weights The tensor that is filled with weight values - * @param[in] biases The tensor that is filled with biase values - * @param[in] output The destination tensor - * @param[in] needs_reshape Whether it needs to be reshaped or not - * @param[in] reshape The tensor shape to be reshaped. Only valid when needs_reshape is true. - * @return N/A - */ - void configure(const arm_compute::ICLTensor *input, const arm_compute::ICLTensor *weights, - const arm_compute::ICLTensor *biases, arm_compute::ICLTensor *output, - bool needs_reshape, const arm_compute::TensorShape &reshape, - KernelType kernel_type); - -public: - /** - * @brief Run the operation. Must be called after configure(). - * @return N/A - */ - void run(void) override; - /** - * @brief Prepare the operation - * @return N/A - */ - void prepare(void) override; - -private: - const arm_compute::ICLTensor *_input; - const arm_compute::ICLTensor *_weights; - const arm_compute::ICLTensor *_biases; - arm_compute::ICLTensor *_output; - - // buffer for reshaping input tensor - arm_compute::CLTensor _cl_buffer; - -private: - std::shared_ptr<IMemoryManager> _memory_manager; - std::unique_ptr<arm_compute::IFunction> _cl_fc; - CLReshapeLayer _cl_reshape; - bool _needs_reshape; -}; -} // namespace arm_compute - -#endif // __ARM_COMPUTE_CL_FULLY_CONNECTED_RESHAPING_LAYER_H__ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLGatherEx.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLGatherEx.h deleted file mode 100644 index b01ec4255..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLGatherEx.h +++ /dev/null @@ -1,85 +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. - */ - -/** - * @file CLGatherEx.h - * @brief This file contains CLGatherEx class - * @ingroup COM_AI_RUNTIME - */ - -#ifndef __ARM_COMPUTE_CLGATHEREX_H__ -#define __ARM_COMPUTE_CLGATHEREX_H__ - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -namespace arm_compute -{ -class ICLTensor; - -/** - * @brief Class to to run @ref CLGatherKernel. - */ -class CLGatherEx : public ICLSimpleFunction -{ -public: - /** - * @brief Initialise the kernel's inputs, output and convertion policy. - * @param[in] input An input tensor. Data types supported: U8/QASYMM8/S32/F32. - * @param[in] indices An indexes tensor. Data types supported: S32. - * @param[out] output The output tensor, Data types supported: same as @p input. - * @param[in] axis (Optional) The axis in @p input to gather @p indices from. Defaults to 0 - * @return N/A - */ - void configure(const ICLTensor *input, const ICLTensor *indices, ICLTensor *output, int axis = 0); - - /** - * @brief Static function to check if given info will lead to a valid configuration - * of @ref CLGatherEx - * @param[in] input An input tensor. Data types supported: U8/QASYMM8/S32/F32. - * @param[in] indices An indexes tensor. Data types supported: S32. - * @param[out] output The output tensor, Data types supported: same as @p input. - * @param[in] axis (Optional) The axis in @p input to gather @p indices from. Defaults to 0 - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *indices, - const ITensorInfo *output, int axis = 0); -}; -} -#endif /*__ARM_COMPUTE_CLGATHEREX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLHashtableLookup.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLHashtableLookup.h deleted file mode 100644 index 6618f5aa4..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLHashtableLookup.h +++ /dev/null @@ -1,82 +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. - */ - -/** - * @file CLHashtableLookup.h - * @ingroup COM_AI_RUNTIME - * @brief This file contains arm_compute::CLHashtableLookup class - */ - -#ifndef __ARM_COMPUTE_CLHASHTABLELOOKUP_H__ -#define __ARM_COMPUTE_CLHASHTABLELOOKUP_H__ - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -#include <vector> - -namespace arm_compute -{ -class ICLTensor; - -/** - * @brief Class to perform HashtableLookup operation - */ -class CLHashtableLookup : public ICLSimpleFunction -{ -public: - /** - * @brief Set the input and output tensors. - * @param[in] lookups Lookups 1D tensor that values are indices into the first dimension of - * input. - * @param[in] keys Keys 1D tensor. keys and input pair represent a map. - * Data types supported: S32 - * @param[in] input Source tensor. - * Data types supported: U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32 - * @param[out] output Destination tensor. Data types and data layouts supported: Same as @p - * input. - * @param[out] hits Hits 1D tensor. A boolean tensor that indicates whether the lookup hits - * (True) or not (False). Data types supported: U8/QASYMM8 - * @return N/A - */ - void configure(const ICLTensor *lookups, const ICLTensor *keys, const ICLTensor *intput, - ICLTensor *output, ICLTensor *hits); -}; -} -#endif /*__ARM_COMPUTE_CLHASHTABLELOOKUP_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLInstanceNormalizationLayerEx.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLInstanceNormalizationLayerEx.h deleted file mode 100644 index 887e7aaa5..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLInstanceNormalizationLayerEx.h +++ /dev/null @@ -1,96 +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. - */ - -/* - * Copyright (c) 2019 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_CLINSTANCENORMALIZATIONLAYEREX_H__ -#define __ARM_COMPUTE_CLINSTANCENORMALIZATIONLAYEREX_H__ - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -namespace arm_compute -{ -class ICLTensor; - -/** Basic function to perform a Instance normalization. - * - * This function runs the following kernels: - * -# @ref CLInstanceNormalizationLayerKernelEx - */ -class CLInstanceNormalizationLayerEx : public ICLSimpleFunction -{ -public: - /** Default constructor */ - CLInstanceNormalizationLayerEx(); - /** Set the input and output tensors. - * - * @param[in, out] input Source tensor. In case of @p output tensor = nullptr this tensor will - * store the result of the normalization. - * Data types supported: F16/F32. Data layout supported: NHWC, NCHW - * @param[out] output Destination tensor. Data types and data layouts supported: same as @p - * input. - * @param[in] gamma (Optional) The scale tensor applied to the normalized tensor. Defaults - * to nullptr - * @param[in] beta (Optional) The offset tensor applied to the normalized tensor. Defaults - * to nullptr - * @param[in] epsilon (Optional) Lower bound value for the normalization. Defaults to 1e-12 - */ - void configure(ICLTensor *input, ICLTensor *output, ICLTensor *gamma = nullptr, - ICLTensor *beta = nullptr, float epsilon = 1e-12f); - - /** Static function to check if given info will lead to a valid configuration of @ref - * CLInstanceNormalizationLayerEx. - * - * @param[in] input Source tensor info. Data types supported: F16/F32. Data layout supported: - * NHWC, NCHW - * @param[in] output Destination tensor info. Data types and data layouts supported: same as @p - * input. - * @param[in] gamma (Optional) The scale tensor applied to the normalized tensor. Defaults to - * nullptr - * @param[in] beta (Optional) The offset tensor applied to the normalized tensor. Defaults to - * nullptr - * @param[in] epsilon (Optional) Lower bound value for the normalization. Defaults to 1e-12 - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, - const ITensorInfo *gamma = nullptr, const ITensorInfo *beta = nullptr, - float epsilon = 1e-12f); -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_CLINSTANCENORMALIZATIONLAYEREX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLNeg.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLNeg.h deleted file mode 100644 index 8ec9aa307..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLNeg.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. - */ - -/* - * 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_CLNEG_H__ -#define __ARM_COMPUTE_CLNEG_H__ - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -namespace arm_compute -{ -class ICLTensor; - -class CLNeg : public ICLSimpleFunction -{ -public: - /** Initialise the function's source and destination. - * - * @param[in] input Source tensor. Data types supported: - * U8/S8/QASYMM8/U16/S16/F16/U32/S32/F32. - * @param[out] output Output tensor. Data types supported: Same as @p input. - * - */ - void configure(ICLTensor *input, ICLTensor *output); -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_CLNEG_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLOneHot.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLOneHot.h deleted file mode 100644 index 2bbfca821..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLOneHot.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2020 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) 2018-2020 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_CLONEHOT_H__ -#define __ARM_COMPUTE_CLONEHOT_H__ -#include "arm_compute/core/CL/kernels/CLMemsetKernel.h" -#include "arm_compute/core/CL/kernels/CLOneHotKernel.h" -#include "arm_compute/runtime/IFunction.h" -namespace arm_compute -{ -class ICLTensor; -/** Basic function to run @ref CLOneHotKernel */ -class CLOneHot : public IFunction -{ -public: - /** Constructor */ - CLOneHot(); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLOneHot(const CLOneHot &) = delete; - /** Default move constructor */ - CLOneHot(CLOneHot &&) = default; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLOneHot &operator=(const CLOneHot &) = delete; - /** Default move assignment operator */ - CLOneHot &operator=(CLOneHot &&) = default; - /** Initialise the kernel's inputs and outputs - * - * @param[in] indices Indices tensor. Supported tensor rank: up to 3. Must be one of the - * following types: U32/S32 - * @param[in] on_value On value tensor. Supported tensor rank: only 1. Data type supported: - * U8/S8/U16/S16/F16/U32/S32/F32 - * @param[in] off_value Off value tensor. Supported tensor rank: only 1. Data type supported: - * Same as @p on_value - * @param[out] output Destination tensor. Data type supported: Same as @p on_value - * @param[in] depth The depth of the one hot dimension. - * @param[in] axis (Optional) The axis to fill. Negative values wrap around. Defaults to -1. - * value must be in range [-indices.rank , indices.rank) - */ - void configure(const ICLTensor *indices, const ICLTensor *on_value, const ICLTensor *off_value, - ICLTensor *output, int depth, int axis = -1); - /** Initialise the kernel's inputs and outputs with off_value being constant - * - * @param[in] indices Indices tensor. Supported tensor rank: up to 3. Must be one of the - * following types: U32/S32 - * @param[in] on_value On value tensor. Supported tensor rank: only 1. Data type supported: - * U8/S8/U16/S16/F16/U32/S32/F32 - * @param[out] output Destination tensor. Data type supported: Same as @p on_value - * @param[in] off_value The PixelValue for off value. Data type supported: Same as @p on_value - * @param[in] depth The depth of the one hot dimension. - * @param[in] axis (Optional) The axis to fill. Negative values wrap around. Defaults to -1. - * value must be in range [-indices.rank , indices.rank) - */ - void configure(const ICLTensor *indices, const ICLTensor *on_value, ICLTensor *output, - PixelValue off_value, int depth, int axis = -1); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLOneHotKernel - * - * @param[in] indices Indices tensor. Supported tensor rank: up to 3. Must be one of the - * following types: U32/S32 - * @param[in] on_value On value tensor. Supported tensor rank: only 1. Data type supported: - * U8/S8/U16/S16/F16/U32/S32/F32 - * @param[in] off_value Off value tensor. Supported tensor rank: only 1. Data type supported: - * Same as @p on_value - * @param[in] output Destination tensor. Data type supported: Same as @p on_value - * @param[in] depth The depth of the one hot dimension. - * @param[in] axis (Optional) The axis to fill. Negative values wrap around. Defaults to -1. - * value must be in range [-indices.rank , indices.rank) - * - * @return a status - */ - static Status validate(const ITensorInfo *indices, const ITensorInfo *on_value, - const ITensorInfo *off_value, const ITensorInfo *output, int depth, - int axis = -1); - - // Inherited methods overridden: - void run() override; - -private: - CLMemsetKernel _memset_kernel; /**< Memset kernel */ - CLOneHotKernel _onehot_kernel; /**< OneHot kernel */ - bool _has_to_memset; -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_CLONEHOT_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLReduceOperation.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLReduceOperation.h deleted file mode 100644 index 7dba84b12..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLReduceOperation.h +++ /dev/null @@ -1,119 +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. - */ - -/** - * @file CLReduceOperation.h - * @ingroup COM_AI_RUNTIME - * @brief This file contains arm_compute::CLReduceOperation class - */ - -#ifndef __ARM_COMPUTE_CLREDUCEOPERATION_H__ -#define __ARM_COMPUTE_CLREDUCEOPERATION_H__ - -#include "arm_compute/core/CL/kernels/CLReduceOperationKernel.h" -#include "arm_compute/core/TypesEx.h" -#include "arm_compute/runtime/MemoryGroup.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/CLTensorAllocator.h" -#include "arm_compute/runtime/CL/functions/CLReshapeLayer.h" -#include "arm_compute/runtime/IFunction.h" -#include "arm_compute/runtime/IMemoryManager.h" - -namespace arm_compute -{ -class ICLTensor; - -/** - * @brief Class to perform ReduceOperation - */ -class CLReduceOperation : public IFunction -{ -public: - /** - * @brief Construct a new ReduceOperation object - */ - CLReduceOperation(std::shared_ptr<IMemoryManager> memory_manager); - - /** - * @brief Set the input and output tensors. - * @param[in] input Source tensor. Data types supported: U8/S32/F32 - * @param[out] output Destination tensor. Data types and data layouts supported: Same as @p - * input. - * @param[in] axis Axis along which to reduce. It must be sorted and no duplicates. - * @param[in] keep_dims If positive, retains reduced dimensions with length 1. - * @param[in] op Reduce operation to perform. - * @return N/A - */ - void configure(ICLTensor *input, ICLTensor *output, const std::set<uint32_t> &axis, - bool keep_dims, ReduceOperation op); - - /** - * @brief Static function to check if given info will lead to a valid configuration of @ref - * CLReduceOperation. - * @param[in] input Source tensor info. Data types supported: U8/S32/F32 - * @param[in] output Destination tensor info. Data types and data layouts supported: Same as @p - * input. - * @param[in] axis Axis along which to reduce. It must be sorted and no duplicates. - * @param[in] keep_dims If positive, retains reduced dimensions with length 1. - * @param[in] op Reduce operation to perform. - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, - const std::set<uint32_t> &axis, bool keep_dims, const ReduceOperation &op); - - /** - * @brief Run the OpenCL kernel for this operation - * @return N/A - */ - void run() override; - -private: - MemoryGroup _memory_group; - ICLTensor *_input; - ICLTensor *_output; - std::set<uint32_t> _axis; - bool _keep_dims; - - std::unique_ptr<CLTensor[]> _interm_tensors{nullptr}; - std::unique_ptr<CLReduceOperationKernel[]> _reduce_kernels{nullptr}; - CLReshapeLayer _reshape; -}; -} -#endif /*__ARM_COMPUTE_CLREDUCEOPERATION_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLSplitVEx.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLSplitVEx.h deleted file mode 100644 index bb741d98d..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLSplitVEx.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2020 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) 2017-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_CLSPLITVEX__ -#define __ARM_COMPUTE_CLSPLITVEX__ - -#include "arm_compute/runtime/IFunction.h" -#include "arm_compute/runtime/CL/functions/CLSlice.h" -#include "arm_compute/core/Types.h" -#include <vector> -#include <memory> - -namespace arm_compute -{ -class ICLTensor; - -/** Basic function to run @ref CLSplitVKernel */ -class CLSplitVEx : public IFunction -{ -public: - /** Default constructor */ - CLSplitVEx(); - /** Configure the split CL kernel - * - * @param[in] input The input tensor to split. Data types supported: - * U8/S8/QASYMM8/U16/S16/F16/U32/S32/F32 - * @param[in] size_splits A 1-D tensor containing the number of tensor values per split - * @param[out] outputs A vector containing the output tensor. Data types supported: Same as @p - * input - * The output tensors should match the input tensor dimensions for all - * shape dimensions apart - * from the split dimension. - * @param[in] split_dim Integer value representing the input tensor dimension along which to - * split - * @param[in] num_splits Number of splits - */ - void configure(const ICLTensor *input, const ICLTensor *size_splits, uint32_t split_dim, - const std::vector<ICLTensor *> &outputs, unsigned int num_splits); - - void run() override; - -private: - const ICLTensor *_input; - const ICLTensor *_size_splits; - std::vector<ICLTensor *> _outputs; - unsigned int _num_splits; - std::vector<CLSlice> _slice_functions; -}; -} -#endif /* __ARM_COMPUTE_CLSPLITVEX__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLTopKV2.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLTopKV2.h deleted file mode 100644 index e301a5152..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLTopKV2.h +++ /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. - */ - -/* - * 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. - */ - -/** - * @file CLTopKV2.h - * @ingroup COM_AI_RUNTIME - * @brief This file contains arm_compute::CLTopKV2 class - */ -#ifndef __ARM_COMPUTE_CLTOPK_V2_H__ -#define __ARM_COMPUTE_CLTOPK_V2_H__ - -#include "arm_compute/core/CL/kernels/CLTopKV2Kernel.h" - -#include "arm_compute/runtime/IFunction.h" - -namespace arm_compute -{ -class ICLTensor; - -/** - * @brief Class to execute TopKV2 operation. - */ -class CLTopKV2 : public IFunction -{ -public: - /** - * @brief Construct a new CLTopKV2 object - */ - CLTopKV2(); - - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers) - */ - CLTopKV2(const CLTopKV2 &) = delete; - - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers) - */ - CLTopKV2 &operator=(const CLTopKV2 &) = delete; - - /** - * @brief Construct a new CLTopKV2 object by using copy constructor - * @param[in] CLTopKV2 object to move - */ - CLTopKV2(CLTopKV2 &&) = default; - - /** - * @brief Assign a CLTopKV2 object. - * @param[in] CLTopKV2 object to assign. This object will be moved. - */ - CLTopKV2 &operator=(CLTopKV2 &&) = default; - - /** - * @brief Initialise the kernel's inputs and outputs. - * @param[in] input Input image. Data types supported: U8/S16/F32. - * @param[in] k The value of `k`. - * @param[out] values Top k values. Data types supported: S32 if input type is U8/S16, F32 if - * input type is F32. - * @param[out] indices Indices related to top k values. Data types supported: S32 if input type - * is U8/S16, F32 if input type is F32. - * @return N/A - */ - void configure(ICLTensor *input, int k, ICLTensor *values, ICLTensor *indices, - int total_bits = 32, int bits = 4); - - /** - * @brief Run the kernels contained in the function - * Depending on the value of the following environment variables it works differently: - * - If the value of environment variable "ACL_TOPKV2" == "GPU_SINGLE", - * quick sort on GPU is used. - * - If the value of environment variable "ACL_TOPKV2" == ""GPU"", - * radix sort on GPU is used. - * - For other value, TopKV2 runs on CPU - * @return N/A - */ - void run() override; - -private: - void run_on_cpu(); - void run_on_gpu(); - void run_on_gpu_single_quicksort(); - - uint32_t _k; - uint32_t _total_bits; - uint32_t _bits; - uint32_t _radix; - uint32_t _hist_buf_size; - uint32_t _glob_sum_buf_size; - uint32_t _n; - - ICLTensor *_input; - ICLTensor *_values; - ICLTensor *_indices; - - cl::Buffer _qs_idx_buf; - cl::Buffer _qs_temp_buf; - cl::Buffer _hist_buf; - cl::Buffer _glob_sum_buf; - cl::Buffer _temp_buf; - cl::Buffer _first_negative_idx_buf; - cl::Buffer _in_key_buf; - cl::Buffer _out_key_buf; - cl::Buffer _in_ind_buf; - cl::Buffer _out_ind_buf; - - cl::Buffer *_p_in_key_buf; - cl::Buffer *_p_out_key_buf; - cl::Buffer *_p_in_ind_buf; - cl::Buffer *_p_out_ind_buf; -// Disable GPU implementation -// TODO Enable GPU implementation with verification, or remove code -// Invalid result on GPU -#if 0 - CLTopKV2Single _qs_kernel; - CLTopKV2Init _init_kernel; - CLRadixSortHistogram _hist_kernel; - CLRadixSortScanHistogram _scan_hist_kernel; - CLRadixSortGlobalScanHistogram _glob_scan_hist_kernel; - CLRadixSortPasteHistogram _paste_hist_kernel; - CLRadixSortReorder _reorder_kernel; - CLTopKV2FindFirstNegative _find_first_negative_kernel; - CLTopKV2ReorderNegatives _reorder_negatives_kernel; - CLTopKV2Store _store_kernel; -#endif -}; -} -#endif // __ARM_COMPUTE_CLTOPK_V2_H__ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLTransposeConvLayer.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLTransposeConvLayer.h deleted file mode 100644 index 5fb102e47..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLTransposeConvLayer.h +++ /dev/null @@ -1,150 +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. - */ - -/* - * Copyright (c) 2017-2020 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_CLTRANSPOSECONVLAYER_H__ -#define __ARM_COMPUTE_CLTRANSPOSECONVLAYER_H__ - -#include "arm_compute/runtime/CL/functions/CLDirectTransposeConvLayer.h" -#include "arm_compute/runtime/CL/functions/CLGEMMDeconvolutionLayer.h" -#include "arm_compute/runtime/IFunction.h" -#include "arm_compute/runtime/IMemoryManager.h" - -#include <memory> - -namespace arm_compute -{ -/** Basic function to compute the deconvolution layer. This function calls the following OpenCL - * kernels/functions: - * - * -# @ref CLGEMMDeconvolutionLayer - * -# @ref CLDirectTransposeConvLayer - */ -class CLTransposeConvLayer : public IFunction -{ -public: - /** Default constructor */ - CLTransposeConvLayer(std::shared_ptr<IMemoryManager> memory_manager = nullptr); - - /** Set the input, weights, biases and output tensors. - * - * @param[in,out] input Input tensor. 3 lower dimensions represent a single input, and an - * optional 4th dimension for batch of inputs. Data types supported: QASYMM8_SIGNED/QASYMM8/F16/F32. - * @param[in] weights The 4d weights with dimensions [width, height, IFM, OFM]. Data type - * supported: Same as @p input. - * @param[in] bias (Optional) The biases have one dimension. Data type supported: Same - * as @p input. - * @param[out] output Output tensor. The output has the same number of dimensions as the - * @p input. - * @param[in] deconv_info Contains padding and policies to be used in the deconvolution, this - * is described in @ref PadStrideInfo. - * @param[in] invalid_right The number of zeros added to right edge of the output. - * @param[in] invalid_bottom The number of zeros added to bottom edge of the output. - * @param[in] weights_info (Optional) Weights information needed for @ref CLConvolutionLayer, - * specifies if the weights tensor has been reshaped with @ref CLWeightsReshapeKernel. - * - */ - void configure(ICLTensor *input, ICLTensor *weights, const ICLTensor *bias, ICLTensor *output, - const PadStrideInfo &deconv_info, unsigned int invalid_right, - unsigned int invalid_bottom, const WeightsInfo &weights_info = WeightsInfo()); - /** Set the input, weights, biases and output tensors. - * - * @param[in] compile_context The compile context to be used. - * @param[in,out] input Input tensor. 3 lower dimensions represent a single input, and - * an optional 4th dimension for batch of inputs. Data types supported: - * QASYMM8_SIGNED/QASYMM8/F16/F32. - * @param[in] weights The 4d weights with dimensions [width, height, IFM, OFM]. Data - * type supported: Same as @p input. - * @param[in] bias (Optional) The biases have one dimension. Data type supported: - * Same as @p input. - * @param[out] output Output tensor. The output has the same number of dimensions as - * the @p input. - * @param[in] deconv_info Contains padding and policies to be used in the deconvolution, - * this is described in @ref PadStrideInfo. - * @param[in] invalid_right The number of zeros added to right edge of the output. - * @param[in] invalid_bottom The number of zeros added to bottom edge of the output. - * @param[in] weights_info (Optional) Weights information needed for @ref - * CLConvolutionLayer, specifies if the weights tensor has been reshaped with @ref - * CLWeightsReshapeKernel. - * - */ - void configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *weights, - const ICLTensor *bias, ICLTensor *output, const PadStrideInfo &deconv_info, - unsigned int invalid_right, unsigned int invalid_bottom, - const WeightsInfo &weights_info = WeightsInfo()); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLTransposeConvLayer - * - * @param[in] input Input tensor info. 3 lower dimensions represent a single input, and an - * optional 4th dimension for batch of inputs. Data types supported: QASYMM8_SIGNED/QASYMM8/F16/F32. - * @param[in] weights The 4d weights info with dimensions [width, height, IFM, OFM]. Data - * type supported: Same as @p input. - * @param[in] bias (Optional) The biases have one dimension. Data type supported: Same as - * @p input. - * @param[in] output Output tensor info. The output has the same number of dimensions as the - * @p input. - * @param[in] deconv_info Contains padding and policies to be used in the deconvolution, this is - * described in @ref PadStrideInfo. - * @param[in] invalid_right The number of zeros added to right edge of the output. - * @param[in] invalid_bottom The number of zeros added to bottom edge of the output. - * @param[in] weights_info (Optional) Weights information needed for @ref CLConvolutionLayer, - * specifies if the weights tensor has been reshaped with @ref CLWeightsReshapeKernel. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *weights, - const ITensorInfo *bias, ITensorInfo *output, - const PadStrideInfo &deconv_info, unsigned int invalid_right, - unsigned int invalid_bottom, - const WeightsInfo &weights_info = WeightsInfo()); - - static DeconvolutionMethod - get_deconvolution_method(const ITensorInfo *input, const ITensorInfo *weights, - const ITensorInfo *bias, ITensorInfo *output, - const PadStrideInfo &deconv_info, unsigned int invalid_right, - unsigned int invalid_bottom, const WeightsInfo &weights_info); - // Inherited methods overridden: - void run() override; - void prepare() override; - -private: - std::shared_ptr<IMemoryManager> _memory_manager; - std::unique_ptr<IFunction> _function; -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_CLTRANSPOSECONVLAYER_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/NEON/NEFunctionsEx.h b/compute/ARMComputeEx/arm_compute/runtime/NEON/NEFunctionsEx.h deleted file mode 100644 index d47b1fe62..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/NEON/NEFunctionsEx.h +++ /dev/null @@ -1,32 +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. - */ -#ifndef __ARM_COMPUTE_NEFUNCTIONSEX_H__ -#define __ARM_COMPUTE_NEFUNCTIONSEX_H__ - -#include <arm_compute/runtime/NEON/functions/NEActivationLayerEx.h> -#include <arm_compute/runtime/NEON/functions/NEBinaryLogicalOperation.h> -#include <arm_compute/runtime/NEON/functions/NECastBool.h> -#include <arm_compute/runtime/NEON/functions/NEEmbeddingLookup.h> -#include <arm_compute/runtime/NEON/functions/NEFullyConnectedReshapingLayer.h> -#include <arm_compute/runtime/NEON/functions/NEGatherEx.h> -#include <arm_compute/runtime/NEON/functions/NEHashtableLookup.h> -#include <arm_compute/runtime/NEON/functions/NEInstanceNormalizationLayerEx.h> -#include <arm_compute/runtime/NEON/functions/NEOneHot.h> -#include <arm_compute/runtime/NEON/functions/NEReduceSum.h> -#include <arm_compute/runtime/NEON/functions/NEReduceOperation.h> -#include <arm_compute/runtime/NEON/functions/NETransposeConvLayer.h> - -#endif // __ARM_COMPUTE_NEFUNCTIONSEX_H__ diff --git a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEActivationLayerEx.h b/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEActivationLayerEx.h deleted file mode 100644 index 6156c84f8..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEActivationLayerEx.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2020 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) 2017-2019 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_NEACTIVATIONLAYEREX_H__ -#define __ARM_COMPUTE_NEACTIVATIONLAYEREX_H__ - -#include "arm_compute/runtime/NEON/INESimpleFunctionNoBorder.h" - -#include "arm_compute/core/Types.h" - -namespace arm_compute -{ -// Forward declarations -class ITensor; - -/** Basic function to run @ref NEActivationLayerKernelEx - * - * @note The function simulates an activation layer with the specified activation function. - */ -class NEActivationLayerEx : public INESimpleFunctionNoBorder -{ -public: - /** Constructor - * - * @param[in] ctx Runtime context to be used by the function - */ - NEActivationLayerEx(IRuntimeContext *ctx = nullptr); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEActivationLayerEx(const NEActivationLayerEx &) = delete; - /** Default move constructor */ - NEActivationLayerEx(NEActivationLayerEx &&) = default; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEActivationLayerEx &operator=(const NEActivationLayerEx &) = delete; - /** Default move assignment operator */ - NEActivationLayerEx &operator=(NEActivationLayerEx &&) = default; - /** [NEActivationLayerEx snippet] **/ - /** Set the input and output tensor. - * - * @note If the output tensor is a nullptr or is equal to the input, the activation function will - * be performed in-place - * - * @param[in, out] input Source tensor. In case of @p output tensor = nullptr, this - * tensor will store the result - * of the activation function. Data types supported: - * QASYMM8/QSYMM16/F16/F32. - * @param[out] output Destination tensor. Data type supported: same as @p input - * @param[in] activation_info Activation layer parameters. - */ - void configure(ITensor *input, ITensor *output, ActivationLayerInfo activation_info); - /** [NEActivationLayerEx snippet] **/ - /** Static function to check if given info will lead to a valid configuration of @ref - * NEActivationLayerEx - * - * @param[in] input Source tensor info. In case of @p output tensor info = nullptr, this tensor - * will store the result - * of the activation function. Data types supported: QASYMM8/QSYMM16/F16/F32. - * @param[in] output Destination tensor info. Data type supported: same as @p input - * @param[in] act_info Activation layer information. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, - const ActivationLayerInfo &act_info); -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_NEACTIVATIONLAYEREX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEBinaryLogicalOperation.h b/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEBinaryLogicalOperation.h deleted file mode 100644 index 026d30098..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEBinaryLogicalOperation.h +++ /dev/null @@ -1,114 +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. - */ - -/* - * Copyright (c) 2018-2019 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_NEBINARYLOGICALOPERATION_H__ -#define __ARM_COMPUTE_NEBINARYLOGICALOPERATION_H__ - -#include "arm_compute/core/TypesEx.h" -#include "arm_compute/runtime/NEON/INESimpleFunction.h" - -namespace arm_compute -{ -class ITensor; - -/** Basic function to run @ref NEBinaryLogicalOperationKernel. - * - * @note The tensor data type for the inputs must be QASYMM8/U8. - * @note The function performs a binary logical operation between two tensors. - */ -class NEBinaryLogicalOperation : public INESimpleFunction -{ -public: - /** Initialise the kernel's inputs, output and conversion policy. - * - * @param[in, out] input1 First tensor input. Data types supported: QASYMM8/U8. - * @param[in, out] input2 Second tensor input. Data types supported: Same as @p input1. - * @param[out] output Output tensor. Data types supported: Same as @p input1. - * @param[in] op Binary Logical Operation to be performed. - */ - void configure(ITensor *input1, ITensor *input2, ITensor *output, BinaryLogicalOperation op); - /** Static function to check if given info will lead to a valid configuration of @ref - * NEBinaryLogicalOperationKernel - * - * @param[in] input1 First tensor input info. Data types supported: QASYMM8/U8. - * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. - * @param[in] output Output tensor info. Data types supported: Same as @p input1. - * @param[in] op Binary Logical Operation to be performed. - * - * @return a status - */ - static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, - const ITensorInfo *output, BinaryLogicalOperation op); -}; - -/** Basic function to run @ref NEBinaryLogicalOperationKernel - * - * @note The tensor data type for the inputs must be QASYMM8/U8. - * @note The function performs a binary logical operation between two tensors. - */ -template <BinaryLogicalOperation op> class NEBinaryLogicalOperationStatic : public INESimpleFunction -{ -public: - /** Initialise the kernel's inputs, output and conversion policy. - * - * @param[in, out] input1 First tensor input. Data types supported: QASYMM8/U8 - * @param[in, out] input2 Second tensor input. Data types supported: Same as @p input1. - * @param[out] output Output tensor. Data types supported: Same as @p input1. - */ - void configure(ITensor *input1, ITensor *input2, ITensor *output); - /** Static function to check if given info will lead to a valid configuration of @ref - * NEBinaryLogicalOperationKernel - * - * @param[in] input1 First tensor input info. Data types supported: QASYMM8/U8 - * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. - * @param[in] output Output tensor info. Data types supported: Same as @p input1. - * - * @return a status - */ - static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, - const ITensorInfo *output); -}; - -/** Basic function to run equal comparison. */ -using NELogicalAnd = NEBinaryLogicalOperationStatic<BinaryLogicalOperation::AND>; -/** Basic function to run not equal comparison. */ -using NELogicalOr = NEBinaryLogicalOperationStatic<BinaryLogicalOperation::OR>; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_NEBINARYLOGICALOPERATION_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NECastBool.h b/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NECastBool.h deleted file mode 100644 index c8b08af8d..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NECastBool.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2020 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) 2019-2020 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_NECASTBOOL_H__ -#define __ARM_COMPUTE_NECASTBOOL_H__ - -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/NEON/INESimpleFunction.h" - -namespace arm_compute -{ -class ITensor; - -/** - * @brief Class to run @ref NECastBoolKernel. - */ -class NECastBool : public INESimpleFunction -{ -public: - /** Initialize the function's source, destination - * - * Valid conversions Input -> Output : - * - * - U8 -> U8, S8, U16, S16, U32, S32, F32, F16 - * - * @param[in] input The input tensor to convert. Data types supported: U8 - * @param[out] output The output tensor. Data types supported: U8/S8/U16/S16/U32/S32/F16/F32. - */ - void configure(const ITensor *input, ITensor *output); - /** Static function to check if given info will lead to a valid configuration of @ref NECastBool - * - * @param[in] input Source tensor info. Data types supported: U8. - * @param[in] output Destination tensor info. Data type supported: U8/S8/U16/S16/U32/S32/F16/F32. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output); -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_NECASTBOOL_H__*/ diff --git a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEEmbeddingLookup.h b/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEEmbeddingLookup.h deleted file mode 100644 index 63f7714aa..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEEmbeddingLookup.h +++ /dev/null @@ -1,88 +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. - */ - -/* - * 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. - */ - -/** - * @file NEEmbeddingLookup.h - * @ingroup COM_AI_RUNTIME - * @brief This file contains arm_compute::NEEmbeddingLookup class - */ - -#ifndef __ARM_COMPUTE_NEEMBEDDINGLOOKUP_H__ -#define __ARM_COMPUTE_NEEMBEDDINGLOOKUP_H__ - -#include "arm_compute/runtime/NEON/INESimpleFunctionNoBorder.h" - -#include <vector> - -namespace arm_compute -{ -class ITensor; - -/** - * @brief Class to perform EmbeddingLookup operation - */ -class NEEmbeddingLookup : public INESimpleFunctionNoBorder -{ -public: - /** - * @brief Set the input and output tensors. - * @param[in] input Source tensor. - * Data types supported: U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32 - * @param[out] output Destination tensor. Data types and data layouts supported: Same as @p - * input. - * @param[in] lookups Lookups 1D tensor that values are indices into the first dimension of - * input. Data types supported: S32. - * @return N/A - */ - void configure(const ITensor *input, ITensor *output, const ITensor *lookups); - /** Static function to check if given info will lead to a valid configuration of @ref NECopy - * - * @param[in] input Source tensor info. Data types supported: - * U8/S8/QASYMM8/U16/S16/F16/U32/S32/F32. - * @param[in] output Output tensor info. Data types supported: Same as @p input. - * @param[in] output Lookups tensor info. Data types supported: S32. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, - const ITensorInfo *lookups); -}; -} -#endif /*__ARM_COMPUTE_NEEMBEDDINGLOOKUP_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEFullyConnectedHybridLayer.h b/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEFullyConnectedHybridLayer.h deleted file mode 100644 index 56548a479..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEFullyConnectedHybridLayer.h +++ /dev/null @@ -1,180 +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. - */ - -/* - * Copyright (c) 2017-2019 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_NEFULLYCONNECTEDHYBRIDLAYER_H__ -#define __ARM_COMPUTE_NEFULLYCONNECTEDHYBRIDLAYER_H__ - -#include "arm_compute/core/NEON/kernels/NEQuantizationSymmetricKernel.h" -#include "arm_compute/core/NEON/kernels/NEGEMMMatrixAccumulateBiasesKernel.h" -#include "arm_compute/core/NEON/kernels/NEMuliplyScaleFactorKernel.h" -#include "arm_compute/core/NEON/kernels/NETransposeKernel.h" -#include "arm_compute/runtime/MemoryGroup.h" -#include "arm_compute/runtime/NEON/functions/NEGEMMLowpMatrixMultiplyCore.h" -#include "arm_compute/runtime/NEON/INESimpleFunctionNoBorder.h" -#include "arm_compute/runtime/Tensor.h" - -namespace arm_compute -{ -/** Basic function to reshape the weights of Fully Connected layer with NEON. This function calls - * the following kernels: - * - * -# @ref NETransposeKernel - * - * @note The fully connected layer accepts "weights" tensors only with 2 dimensions. - */ -class NEFullyConnectedHybridLayerReshapeWeights : public INESimpleFunctionNoBorder -{ -public: - /** Set the input and output tensors. - * - * @param[in] input Weights tensor. The weights must be 2 dimensional. Data types supported: - * QASYMM8/F16/F32. - * @param[out] output Destination tensor. Data type supported: Same as @p input. - */ - void configure(const ITensor *input, ITensor *output); - /** Static function to check if given info will lead to a valid configuration of @ref - * NEFullyConnectedHybridLayerReshapeWeights - * - * @param[in] input Weights tensor info. The weights must be 2 dimensional. Data types supported: - * QASYMM8/F16/F32. - * @param[in] output Destination tensor info. Data type supported: Same as @p input. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output); -}; - -/** Basic function to compute a Fully Connected layer on NEON. This function calls the following - * NEON kernels: - * -# @ref NEIm2ColKernel (called when the input comes from a convolutional layer) - * -# @ref NEFullyConnectedHybridLayerReshapeWeights (if @p are_weights_reshaped is set to false - * and transpose_weights is set to true ) (called once) - * -# @ref NEGEMMMatrixMultiplyKernel or @ref NEGEMMLowpMatrixMultiplyCore (if quantized - * asymmetric) - * -# @ref NEGEMMMatrixAccumulateBiasesKernel or @ref - * NEGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPoint (if quantized asymmetric) (if @p biases is - * not equal to nullptr) - * - * @note The fully connected layer accepts "weights" tensors only with 2 dimensions. - */ -class NEFullyConnectedHybridLayer : public IFunction -{ -public: - /** Constructor */ - NEFullyConnectedHybridLayer(std::shared_ptr<IMemoryManager> memory_manager = nullptr); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEFullyConnectedHybridLayer(const NEFullyConnectedHybridLayer &) = delete; - /** Default move constructor */ - NEFullyConnectedHybridLayer(NEFullyConnectedHybridLayer &&) = default; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEFullyConnectedHybridLayer &operator=(const NEFullyConnectedHybridLayer &) = delete; - /** Default move assignment operator */ - NEFullyConnectedHybridLayer &operator=(NEFullyConnectedHybridLayer &&) = default; - /** Set the input and output tensors. - * - * @param[in] input Source tensor. Data type supported: F16/F32. - * @param[in] weights Weights tensor. The weights must be 2 dimensional. - * If this function is called after a Convolution Layer, the (transposed) - * weights will have as many rows as the product of the first 3 input's dimensions. - * If it is called after another FullyConnected Layer, the (transposed) - * weights will have as many rows as the input's first dimension. - * Data type supported: S8. - * @param[in] biases Bias tensor. Can be nullptr. Data type supported:Same as @p input. - * @param[out] output Destination tensor. Its shape should be equal to the output of a matrix - * multiplication between: - * - The output of im2col on the input and the (transposed) 2D weights, if the - * function is called after a Convolution Layer - * - The input tensor and the (transposed) 2D weights, if the function is - * called after another FullyConnected Layer. - * Data type supported: Same as @p input. - * @param[in] fc_info (Optional) Fully connected layer additional info - */ - void configure(const ITensor *input, const ITensor *weights, const ITensor *biases, - ITensor *output, FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo()); - /** Static function to check if given info will lead to a valid configuration of @ref - * NEFullyConnectedHybridLayer - * - * @param[in] input Source tensor info. Data type supported: F16/F32. - * @param[in] weights Weights tensor info. The weights must be 2 dimensional. - * If this function is called after a Convolution Layer, the (transposed) - * weights will have as many rows as the product of the first 3 input's dimensions. - * If it is called after another FullyConnected Layer, the (transposed) - * weights will have as many rows as the input's first dimension. - * Data type supported: S8. - * @param[in] biases Bias tensor info. Can be nullptr. Data type supported:Same as @p input. - * @param[out] output Destination tensor info. Its shape should be equal to the output of a - * matrix multiplication between: - * - The output of im2col on the input and the (transposed) 2D weights, if the - * function is called after a Convolution Layer - * - The input tensor and the (transposed) 2D weights, if the function is - * called after another FullyConnected Layer. - * Data type supported: Same as @p input. - * @param[in] fc_info (Optional) Fully connected layer additional info - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *weights, - const ITensorInfo *biases, const ITensorInfo *output, - FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo()); - - // Inherited methods override - void run() override; - void prepare() override; - -private: - void configure_mm(const ITensor *input, const ITensor *weights, ITensor *output); - - MemoryGroup _memory_group; - NEFullyConnectedHybridLayerReshapeWeights _reshape_weights_function; - NEQuantizationSymmetricKernel _quant_input_kernel; - NEGEMMLowpMatrixMultiplyCore _mm_gemmlowp; - NEMultiplyScaleFactorKernel _multiply_scale_kernel; - NEGEMMMatrixAccumulateBiasesKernel _accumulate_biases_kernel; - Tensor _reshape_weights_output; - Tensor _quantized_input; - Tensor _scale_factor; - Tensor _gemmlowp_output; - const ITensor *_original_weights; - bool _are_weights_reshaped; - bool _accumulate_biases; - bool _is_prepared; -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_NEFULLYCONNECTEDHYBRIDLAYER_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEFullyConnectedLayerEx.h b/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEFullyConnectedLayerEx.h deleted file mode 100644 index 8f98f220a..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEFullyConnectedLayerEx.h +++ /dev/null @@ -1,164 +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. - */ - -/* - * Copyright (c) 2017-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_NEFULLYCONNECTEDLAYEREX_H__ -#define __ARM_COMPUTE_NEFULLYCONNECTEDLAYEREX_H__ - -#include "arm_compute/runtime/IFunction.h" - -#include "arm_compute/core/NEON/kernels/NEFlattenLayerKernel.h" -#include "arm_compute/core/NEON/kernels/NEGEMMMatrixAccumulateBiasesKernel.h" -#include "arm_compute/core/NEON/kernels/NETransposeKernel.h" -#include "arm_compute/runtime/MemoryGroup.h" -#include "arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h" -#include "arm_compute/runtime/NEON/functions/NEConvertFullyConnectedWeights.h" -#include "arm_compute/runtime/NEON/functions/NEGEMM.h" -#include "arm_compute/runtime/NEON/functions/NEGEMMLowpMatrixMultiplyCore.h" -#include "arm_compute/runtime/NEON/functions/NEGEMMLowpOutputStage.h" -#include "arm_compute/runtime/Tensor.h" - -namespace arm_compute -{ -/** Basic function to compute a Fully Connected layer on NEON. This function calls the following - * NEON kernels: - * -# @ref NEIm2ColKernel (called when the input comes from a convolutional layer) - * -# @ref NEFullyConnectedLayerReshapeWeights (if @p are_weights_reshaped is set to false and - * transpose_weights is set to true ) (called once) - * -# @ref NEGEMMMatrixMultiplyKernel or @ref NEGEMMLowpMatrixMultiplyCore (if quantized - * asymmetric) - * -# @ref NEGEMMMatrixAccumulateBiasesKernel or @ref - * NEGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPoint (if quantized asymmetric) (if @p biases is - * not equal to nullptr) - * - * @note The fully connected layer accepts "weights" tensors only with 2 dimensions. - * @note The difference from NEFullyConnectedLayer is that this class supports weights as input - * with performance loss. - */ -class NEFullyConnectedLayerEx : public IFunction -{ -public: - /** Constructor */ - NEFullyConnectedLayerEx(std::shared_ptr<IMemoryManager> memory_manager = nullptr); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEFullyConnectedLayerEx(const NEFullyConnectedLayerEx &) = delete; - /** Default move constructor */ - NEFullyConnectedLayerEx(NEFullyConnectedLayerEx &&) = default; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEFullyConnectedLayerEx &operator=(const NEFullyConnectedLayerEx &) = delete; - /** Default move assignment operator */ - NEFullyConnectedLayerEx &operator=(NEFullyConnectedLayerEx &&) = default; - /** Set the input and output tensors. - * - * @param[in] input Source tensor. Data type supported: QASYMM8/F16/F32. - * @param[in] weights Weights tensor. The weights must be 2 dimensional. - * If this function is called after a Convolution Layer, the (transposed) - * weights will have as many rows as the product of the first 3 input's dimensions. - * If it is called after another FullyConnected Layer, the (transposed) - * weights will have as many rows as the input's first dimension. - * Data type supported: Same as @p input. - * @param[in] biases Bias tensor. Can be nullptr. Data type supported:Same as @p input. - * @param[out] output Destination tensor. Its shape should be equal to the output of a matrix - * multiplication between: - * - The output of im2col on the input and the (transposed) 2D weights, if the - * function is called after a Convolution Layer - * - The input tensor and the (transposed) 2D weights, if the function is - * called after another FullyConnected Layer. - * Data type supported: Same as @p input. - * @param[in] fc_info (Optional) Fully connected layer additional info - */ - void configure(const ITensor *input, const ITensor *weights, const ITensor *biases, - ITensor *output, FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo()); - /** Static function to check if given info will lead to a valid configuration of @ref - * NEFullyConnectedLayerEx - * - * @param[in] input Source tensor info. Data type supported: QASYMM8/F16/F32. - * @param[in] weights Weights tensor info. The weights must be 2 dimensional. - * If this function is called after a Convolution Layer, the (transposed) - * weights will have as many rows as the product of the first 3 input's dimensions. - * If it is called after another FullyConnected Layer, the (transposed) - * weights will have as many rows as the input's first dimension. - * Data type supported: Same as @p input. - * @param[in] biases Bias tensor info. Can be nullptr. Data type supported:Same as @p input. - * @param[out] output Destination tensor info. Its shape should be equal to the output of a - * matrix multiplication between: - * - The output of im2col on the input and the (transposed) 2D weights, if the - * function is called after a Convolution Layer - * - The input tensor and the (transposed) 2D weights, if the function is - * called after another FullyConnected Layer. - * Data type supported: Same as @p input. - * @param[in] fc_info (Optional) Fully connected layer additional info - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *weights, - const ITensorInfo *biases, const ITensorInfo *output, - FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo()); - - // Inherited methods override - void run() override; - void prepare() override; - -private: - void configure_fc_fc(const ITensor *input, const ITensor *weights, ITensor *output); - void configure_conv_fc(const ITensor *input, const ITensor *weights, ITensor *output); - void configure_mm(const ITensor *input, const ITensor *weights, ITensor *output); - - MemoryGroup _memory_group; - NEFlattenLayerKernel _flatten_kernel; - NEConvertFullyConnectedWeights _convert_weights; - NEFullyConnectedLayerReshapeWeights _reshape_weights_function; - NEGEMM _mm_gemm; - NEGEMMLowpMatrixMultiplyCore _mm_gemmlowp; - NEGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPoint _gemmlowp_output_stage; - NEGEMMMatrixAccumulateBiasesKernel _accumulate_biases_kernel; - Tensor _flatten_output; - Tensor _gemmlowp_output; - Tensor _converted_weights_output; - Tensor _reshape_weights_output; - const ITensor *_original_weights; - bool _are_weights_converted; - bool _are_weights_reshaped; - bool _is_fc_after_conv; - bool _accumulate_biases; - bool _is_quantized; - bool _is_prepared; -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_NEFULLYCONNECTEDLAYEREX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEFullyConnectedReshapingLayer.h b/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEFullyConnectedReshapingLayer.h deleted file mode 100644 index 18cb61bf9..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEFullyConnectedReshapingLayer.h +++ /dev/null @@ -1,98 +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       NEFullyConnectedReshapingLayer.h - * @brief      This file contains NEFullyConnectedReshapingLayer class - * @ingroup    COM_AI_RUNTIME - */ - -#ifndef __ARM_COMPUTE_NE_FULLY_CONNECTED_RESHAPING_LAYER_H__ -#define __ARM_COMPUTE_NE_FULLY_CONNECTED_RESHAPING_LAYER_H__ - -#include <arm_compute/runtime/NEON/functions/NEReshapeLayer.h> -#include <arm_compute/runtime/IMemoryManager.h> -#include <arm_compute/runtime/Tensor.h> - -namespace arm_compute -{ -/** - * @brief Class to run FullyConnected Layer after reshaping input tensor - */ -class NEFullyConnectedReshapingLayer : public arm_compute::IFunction -{ -public: - enum class KernelType - { - GENERAL, //< General FC - PREPROCESSED_WEIGHTS //< Weights are constants so it can be preprocessed - }; - -public: - NEFullyConnectedReshapingLayer(std::shared_ptr<IMemoryManager> memory_manager = nullptr) - : _memory_manager{memory_manager}, _input(nullptr), _weights(nullptr), _biases(nullptr), - _output(nullptr), _neon_buffer{}, _neon_fc{nullptr}, _neon_reshape{}, _needs_reshape(false) - { - // DO NOTHING - } - -public: - /** - * @brief Configure the layer - * @param[in] input The source tensor - * @param[in] weights The tensor that is filled with weight values - * @param[in] biases The tensor that is filled with biase values - * @param[in] output The destination tensor - * @param[in] needs_reshape Whether it needs to be reshaped or not - * @param[in] reshape The tensor shape to be reshaped. Only valid when needs_reshape is true. - * @param[in] kernel_type The kernel type for actual FullyConnected layer - * @return N/A - */ - void configure(const arm_compute::ITensor *input, const arm_compute::ITensor *weights, - const arm_compute::ITensor *biases, arm_compute::ITensor *output, - bool needs_reshape, const arm_compute::TensorShape &reshape, - KernelType kernel_type); - -public: - /** - * @brief Run the operation. Must be called after configure(). - * @return N/A - */ - void run(void) override; - /** - * @brief Prepare the operation - * @return N/A - */ - void prepare(void) override; - -private: - std::shared_ptr<IMemoryManager> _memory_manager; - const arm_compute::ITensor *_input; - const arm_compute::ITensor *_weights; - const arm_compute::ITensor *_biases; - arm_compute::ITensor *_output; - - // buffer for reshaping input tensor - arm_compute::Tensor _neon_buffer; - -private: - std::unique_ptr<arm_compute::IFunction> _neon_fc; - NEReshapeLayer _neon_reshape; - bool _needs_reshape; -}; -} // namespace arm_compute - -#endif // __ARM_COMPUTE_NE_FULLY_CONNECTED_RESHAPING_LAYER_H__ diff --git a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEGatherEx.h b/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEGatherEx.h deleted file mode 100644 index 155a1b837..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEGatherEx.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. - */ - -/* - * Copyright (c) 2019 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_NEGATHEREX_H__ -#define __ARM_COMPUTE_NEGATHEREX_H__ - -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/NEON/INESimpleFunctionNoBorder.h" - -namespace arm_compute -{ -class ITensor; - -/** Basic function to run @ref NEGatherKernelEx */ -class NEGatherEx : public INESimpleFunctionNoBorder -{ -public: - /** Initialise the kernel's inputs and outputs - * - * @param[in] input Source tensor. Supported tensor rank: up to 4. Data type supported: - * U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32 - * @param[in] indices Indices tensor. Supported tensor rank: up to 3. Must be one of the - * following type: U32/S32. Each value Must be in range [0, input.shape[@p axis]) - * @param[out] output Destination tensor. Data type supported: Same as @p input - * @param[in] axis (Optional) The axis in @p input to gather @p indices from. Defaults to 0 - */ - void configure(const ITensor *input, const ITensor *indices, ITensor *output, int axis = 0); - - /** Static function to check if given info will lead to a valid configuration of @ref - * NEGatherKernelEx - * - * @param[in] input Source tensor info. Supported tensor rank: up to 4. Data type supported: - * U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32 - * @param[in] indices Indices tensor info. Supported tensor rank: up to 3. Must be one of the - * following types: U32/S32. Each value Must be in range [0, input.shape[@p axis]) - * @param[in] output Destination tensor info. Data type supported: Same as @p input - * @param[in] axis (Optional) The axis in @p input to gather @p indices from. Defaults to 0 - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *indices, - const ITensorInfo *output, int axis); -}; - -} // namespace arm_compute - -#endif /* __ARM_COMPUTE_NEGATHEREX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEHashtableLookup.h b/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEHashtableLookup.h deleted file mode 100644 index 521a05ad9..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEHashtableLookup.h +++ /dev/null @@ -1,100 +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. - */ - -/* - * 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. - */ - -/** - * @file NEHashtableLookup.h - * @ingroup COM_AI_RUNTIME - * @brief This file contains arm_compute::NEHashtableLookup class - */ - -#ifndef __ARM_COMPUTE_NEHASHTABLELOOKUP_H__ -#define __ARM_COMPUTE_NEHASHTABLELOOKUP_H__ - -#include "arm_compute/runtime/NEON/INESimpleFunctionNoBorder.h" - -#include <vector> - -namespace arm_compute -{ -class ITensor; - -/** - * @brief Class to perform HashtableLookup operation - */ -class NEHashtableLookup : public INESimpleFunctionNoBorder -{ -public: - /** - * @brief Set the input and output tensors. - * @param[in] lookups Lookups 1D tensor that values are indices into the first dimension of - * input. Data types supported: S32 - * @param[in] keys Keys 1D tensor. keys and input pair represent a map. - * Data types supported: S32 - * @param[in] input Source tensor. - * Data types supported: U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32 - * @param[out] output Destination tensor. Data types and data layouts supported: Same as @p - * input. - * @param[out] hits Hits 1D tensor. A boolean tensor that indicates whether the lookup hits - * (True) or not (False). Data types supported: U8/QASYMM8 - * @return N/A - */ - void configure(const ITensor *lookups, const ITensor *keys, const ITensor *input, ITensor *output, - ITensor *hits); - /** Static function to check if given info will lead to a valid configuration of @ref NECopy - * - * @param[in] lookups Lookups 1D tensor info. - * Data types supported: S32 - * @param[in] keys Keys 1D tensor info. keys and input pair represent a map. - * Data types supported: S32 - * @param[in] input Source tensor info. - * Data types supported: U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32 - * @param[in] output Destination tensor info. Data types and data layouts supported: Same as @p - * input. - * @param[in] hits Hits 1D tensor info. A boolean tensor that indicates whether the lookup - * hits (True) or not (False). Data types supported: U8/QASYMM8 - * - * @return a status - */ - static Status validate(const ITensorInfo *lookups, const ITensorInfo *keys, - const ITensorInfo *input, const ITensorInfo *output, - const ITensorInfo *hits); -}; -} -#endif /*__ARM_COMPUTE_NEHASHTABLELOOKUP_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEInstanceNormalizationLayerEx.h b/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEInstanceNormalizationLayerEx.h deleted file mode 100644 index 18e813923..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEInstanceNormalizationLayerEx.h +++ /dev/null @@ -1,116 +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. - */ - -/* - * Copyright (c) 2019 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_NEINSTANCENORMALIZATIONLAYEREX_H__ -#define __ARM_COMPUTE_NEINSTANCENORMALIZATIONLAYEREX_H__ - -#include "arm_compute/core/NEON/kernels/NEInstanceNormalizationLayerKernelEx.h" -#include "arm_compute/runtime/IFunction.h" -#include "arm_compute/runtime/IMemoryManager.h" -#include "arm_compute/runtime/MemoryGroup.h" -#include "arm_compute/runtime/NEON/functions/NEPermute.h" -#include "arm_compute/runtime/NEON/functions/NEReductionOperation.h" -#include "arm_compute/runtime/Tensor.h" - -#include <memory> - -namespace arm_compute -{ -class ITensor; - -/** Basic function to perform a Instance normalization. - * - * This function runs the following kernels: - * -# @ref NEInstanceNormalizationLayerKernelEx - */ -class NEInstanceNormalizationLayerEx : public IFunction -{ -public: - /** Constructor */ - NEInstanceNormalizationLayerEx(std::shared_ptr<IMemoryManager> memory_manager = nullptr); - /** Set the input and output tensors. - * - * @param[in, out] input Source tensor. In case of @p output tensor = nullptr this tensor will - * store the result of the normalization. - * Data types supported: F16/F32. Data layout supported: NHWC, NCHW - * @param[out] output Destination tensor. Data types and data layouts supported: same as @p - * input. - * @param[in] gamma (Optional) The scale scalar value applied to the normalized tensor. - * Defaults to 1.0 - * @param[in] beta (Optional) The offset scalar value applied to the normalized tensor. - * Defaults to 0.0 - * @param[in] epsilon (Optional) Lower bound value for the normalization. Defaults to 1e-12 - */ - void configure(ITensor *input, ITensor *output, ITensor *gamma, ITensor *beta, - float epsilon = 1e-12f); - - /** Static function to check if given info will lead to a valid configuration of @ref - * NEInstanceNormalizationLayer. - * - * @param[in] input Source tensor info. Data types supported: F16/F32. Data layout supported: - * NHWC, NCHW - * @param[in] output Destination tensor info. Data types and data layouts supported: same as @p - * input. - * @param[in] gamma (Optional) The scale scalar value applied to the normalized tensor. Defaults - * to 1.0 - * @param[in] beta (Optional) The offset scalar value applied to the normalized tensor. - * Defaults to 0.0 - * @param[in] epsilon (Optional) Lower bound value for the normalization. Defaults to 1e-12 - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, - const ITensorInfo *gamma = nullptr, const ITensorInfo *beta = nullptr, - float epsilon = 1e-12f); - - // Inherited methods overridden: - void run() override; - -private: - MemoryGroup _memory_group; - NEInstanceNormalizationLayerKernelEx _normalization_kernel; - bool _is_nchw; - NEPermute _permute_input; - NEPermute _permute_output; - Tensor _permuted_input; - Tensor _permuted_output; -}; -} -#endif /* __ARM_COMPUTE_NEINSTANCENORMALIZATIONLAYEREX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEOneHot.h b/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEOneHot.h deleted file mode 100644 index b2ea6270f..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEOneHot.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2020 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) 2019 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_NEONEHOT_H__ -#define __ARM_COMPUTE_NEONEHOT_H__ -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/NEON/INESimpleFunctionNoBorder.h" -namespace arm_compute -{ -// Forward declarations -class ITensor; -/** Basic function to run @ref NEOneHotKernel */ -class NEOneHot : public INESimpleFunctionNoBorder -{ -public: - /** Initialise the kernel's inputs and outputs - * - * @param[in] indices Indices tensor. Supported tensor rank: up to 3. Must be one of the - * following types: U32/S32 - * @param[in] depth The tensor for depth of the one hot dimension. Supported tensor rank: up - * to 3. Must be one of the following types: U32/S32 - * @param[in] on_value On value tensor. Supported tensor rank: only 1. Data type supported: - * U8/S8/U16/S16/F16/U32/S32/F32 - * @param[in] off_value Off value tensor. Supported tensor rank: only 1. Data type supported: - * Same as @p on_value - * @param[out] output Destination tensor. Data type supported: Same as @p on_value - * @param[in] axis (Optional) The axis to fill. Negative values wrap around. Defaults to -1. - * The value must be in range [-indices.rank , indices.rank) - */ - void configure(const ITensor *indices, const ITensor *depth, const ITensor *on_value, - const ITensor *off_value, ITensor *output, int axis = -1); - /** Static function to check if given info will lead to a valid configuration of @ref - * NEOneHotKernel - * - * @param[in] indices Indices tensor info. Supported tensor rank: up to 3. Must be one of the - * following types: U32/S32 - * @param[in] depth The tensor info for depth of the one hot dimension. Supported tensor rank: - * up to 3. Must be one of the following types: U32/S32 - * @param[in] on_value On value tensor info. Supported tensor rank: only 1. Data type supported: - * U8/S8/U16/S16/F16/U32/S32/F32 - * @param[in] off_value Off value tensor info. Supported tensor rank: only 1. Data type supported: - * Same as @p on_value - * @param[out] output Destination tensor info. Data type supported: Same as @p on_value - * @param[in] axis (Optional) The axis to fill. Negative values wrap around. Defaults to -1. - * The value must be in range [-indices.rank , indices.rank) - * - * @return a status - */ - static Status validate(const ITensorInfo *indices, const ITensorInfo *depth, - const ITensorInfo *on_value, const ITensorInfo *off_value, - const ITensorInfo *output, int axis = -1); -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_NEONEHOT_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEReduceOperation.h b/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEReduceOperation.h deleted file mode 100644 index 7f764b000..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEReduceOperation.h +++ /dev/null @@ -1,102 +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. - */ - -/* - * Copyright (c) 2018-2019 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_NEON_REDUCE_OPERATION_H__ -#define __ARM_COMPUTE_NEON_REDUCE_OPERATION_H__ - -#include "arm_compute/runtime/IFunction.h" - -#include "arm_compute/core/NEON/kernels/NEFillBorderKernel.h" -#include "arm_compute/core/TypesEx.h" -#include "arm_compute/runtime/MemoryGroup.h" -#include "arm_compute/runtime/NEON/functions/NEReductionOperationEx.h" -#include "arm_compute/runtime/NEON/functions/NEReshapeLayer.h" -#include "arm_compute/runtime/Tensor.h" - -namespace arm_compute -{ -class ITensor; - -/** Basic function to perform reduce operation */ -class NEReduceOperation : public IFunction -{ -public: - /** Constructor */ - NEReduceOperation(std::shared_ptr<IMemoryManager> memory_manager = nullptr); - /** Configure kernel - * - * @note Supported tensor rank: up to 4 - * - * @param[in] input Source tensor. Data type supported: QASYMM8/F16/F32 - * @param[in] reduction_axis Reduction axis vector. - * @param[in] keep_dims If positive, retains reduced dimensions with length 1. - * @param[out] output Destination tensor. Data type supported: Same as @p input - * @param[in] op Reduce operation to perform. - */ - void configure(ITensor *input, const Coordinates &reduction_axis, bool keep_dims, ITensor *output, - ReduceOperation op); - - /** Static function to check if given info will lead to a valid configuration of @ref - * NEReduceOperation - * - * @param[in] input Source tensor. Data type supported: QASYMM8/F16/F32 - * @param[in] reduction_axis Reduction axis vector. - * @param[in] keep_dims If positive, retains reduced dimensions with length 1. - * @param[in] output Destination tensor. Data type supported: Same as @p input - * @param[in] op Reduce operation to perform. - * - * @return A status - */ - static Status validate(const ITensorInfo *input, const Coordinates &reduction_axis, - bool keep_dims, const ITensorInfo *output, ReduceOperation op); - - // Inherited methods overridden: - void run() override; - -private: - MemoryGroup _memory_group; - std::vector<NEReductionOperationEx> _reduction_kernels; - std::vector<Tensor> _reduced_outs; - NEReshapeLayer _reshape; - unsigned int _reduction_ops; - bool _keep_dims; -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_NEON_REDUCE_OPERATION_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEReduceSum.h b/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEReduceSum.h deleted file mode 100644 index 48b416923..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEReduceSum.h +++ /dev/null @@ -1,98 +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. - */ - -/* - * Copyright (c) 2018-2019 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_NEON_REDUCE_SUM_H__ -#define __ARM_COMPUTE_NEON_REDUCE_SUM_H__ - -#include "arm_compute/runtime/IFunction.h" - -#include "arm_compute/core/NEON/kernels/NEFillBorderKernel.h" -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/MemoryGroup.h" -#include "arm_compute/runtime/NEON/functions/NEReductionOperation.h" -#include "arm_compute/runtime/NEON/functions/NEReshapeLayer.h" - -namespace arm_compute -{ -class ITensor; - -/** Basic function to perform reduce operation */ -class NEReduceSum : public IFunction -{ -public: - /** Constructor */ - NEReduceSum(std::shared_ptr<IMemoryManager> memory_manager = nullptr); - /** Configure kernel - * - * @note Supported tensor rank: up to 4 - * - * @param[in] input Source tensor. Data type supported: QASYMM8/F16/F32 - * @param[in] reduction_axis Reduction axis vector. - * @param[in] keep_dims If positive, retains reduced dimensions with length 1. - * @param[out] output Destination tensor. Data type supported: Same as @p input - */ - void configure(ITensor *input, const Coordinates &reduction_axis, bool keep_dims, - ITensor *output); - - /** Static function to check if given info will lead to a valid configuration of @ref NEReduceSum - * - * @param[in] input Source tensor. Data type supported: QASYMM8/F16/F32 - * @param[in] reduction_axis Reduction axis vector. - * @param[in] keep_dims If positive, retains reduced dimensions with length 1. - * @param[in] output Destination tensor. Data type supported: Same as @p input - * - * @return A status - */ - static Status validate(const ITensorInfo *input, const Coordinates &reduction_axis, - bool keep_dims, const ITensorInfo *output); - - // Inherited methods overridden: - void run() override; - -private: - MemoryGroup _memory_group; - std::vector<NEReductionOperation> _reduction_kernels; - std::vector<Tensor> _reduced_outs; - NEReshapeLayer _reshape; - unsigned int _reduction_ops; - bool _keep_dims; -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_NEON_REDUCE_SUM_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEReductionOperationEx.h b/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEReductionOperationEx.h deleted file mode 100644 index 1693922b7..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NEReductionOperationEx.h +++ /dev/null @@ -1,99 +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. - */ - -/* - * Copyright (c) 2017-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_NEREDUCTIONOPERATIONEX_H__ -#define __ARM_COMPUTE_NEREDUCTIONOPERATIONEX_H__ - -#include "arm_compute/runtime/IFunction.h" - -#include "arm_compute/core/NEON/kernels/NEFillBorderKernel.h" -#include "arm_compute/core/NEON/kernels/NEReductionOperationKernelEx.h" -#include "arm_compute/core/TypesEx.h" - -namespace arm_compute -{ -class ITensor; - -/** Basic function to simulate a reduction operation. This function calls the following NEON - * kernels: - * - * -# @ref NEFillBorderKernel - * -# @ref NEReductionOperationKernelEx - * - */ -class NEReductionOperationEx : public IFunction -{ -public: - /** Default constructor */ - NEReductionOperationEx(); - /** Set the input and output tensors. - * - * @param[in] input Source tensor. Data type supported: QASYMM8/F16/F32. - * @param[out] output Destination tensor. Data types and data layouts supported: same as @p input. - * @param[in] axis Dimension along which to reduce. - * @param[in] op Reduction operation to perform. - */ - void configure(ITensor *input, ITensor *output, unsigned int axis, ReduceOperation op); - - /** Static function to check if given info will lead to a valid configuration of @ref - * NEReductionOperationEx. - * - * @param[in] input Source tensor info. Data type supported: QASYMM8/F16/F32. - * @param[in] output Destination tensor info. Data types and data layouts supported: same as @p - * input. - * @param[in] axis Dimension along which to reduce. - * @param[in] op Reduction operation to perform. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, unsigned int axis, - ReduceOperation op); - - // Inherited methods overridden: - void run() override; - -private: - NEReductionOperationKernelEx _reduction_kernel; - NEFillBorderKernel _fill_border_kernel; - size_t _window_split; - int _reduction_axis; -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_NEREDUCTIONOPERATIONEX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NETransposeConvLayer.h b/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NETransposeConvLayer.h deleted file mode 100644 index 24ff5dac9..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/NEON/functions/NETransposeConvLayer.h +++ /dev/null @@ -1,172 +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. - */ - -/* - * Copyright (c) 2017-2020 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_NETRANSPOSECONVLAYER_H__ -#define __ARM_COMPUTE_NETRANSPOSECONVLAYER_H__ - -#include "arm_compute/runtime/CPP/functions/CPPUpsample.h" -#include "arm_compute/runtime/NEON/functions/NEConvolutionLayer.h" -#include "arm_compute/runtime/NEON/functions/NEDirectConvolutionLayer.h" -#include "arm_compute/runtime/NEON/functions/NEReverse.h" - -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/IFunction.h" -#include "arm_compute/runtime/IMemoryManager.h" -#include "arm_compute/runtime/MemoryGroup.h" -#include "arm_compute/runtime/Tensor.h" - -#include <memory> - -namespace arm_compute -{ -/** Function to run the deconvolution layer. - * - * Deconvolution Layer is the backward pass of Convolution Layer. First we transform the input - * depending on the stride and pad info and then perfrom a 1x1 - * convolution pass. Input stride defines how many zeroes we should put between each element of the - * input, pad is the amount of padding and finaly a is a user - * specified value where a < stride - 1 that increases the padding top and right of the input image. - * - * The relation between input to output is as follows: - * \f[ - * width\_output = (width\_input - 1) \cdot stride\_x - 2 \cdot padding\_x + kernel\_x - * \f] - * \f[ - * height\_output = (height\_input - 1) \cdot stride\_y - 2 \cdot padding\_y + kernel\_y - * \f] - * - * where - * width is the size of the first input dimension. - * height is the size of the second input dimension. - * width_output is the size of the first output dimension. - * height_output is the size of the second output dimension. - * kernel_x and kernel_y are the convolution sizes in x and y. - * stride_x and stride_y is the input stride of the first and second dimension. - * - * The weights used by Deconvolution are supposed to be the same as the ones used for Convolution. - * Therefore, it will be necessary to use the weights in the - * reverse order to perform an actual convolution. This is achieved by using @ref NEReverse. - * - * This function calls the following NEON kernels/functions: - * - * -# @ref CPPUpsampleEx - * -# @ref NEConvolutionLayer - * -# @ref NEPermute - * -# @ref NEReverse - * - */ -class NETransposeConvLayer : public IFunction -{ -public: - /** Constructor */ - NETransposeConvLayer(std::shared_ptr<IMemoryManager> memory_manager = nullptr); - - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NETransposeConvLayer(const NETransposeConvLayer &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NETransposeConvLayer &operator=(const NETransposeConvLayer &) = delete; - /** Allow instances of this class to be moved */ - NETransposeConvLayer(NETransposeConvLayer &&) = default; - /** Allow instances of this class to be moved */ - NETransposeConvLayer &operator=(NETransposeConvLayer &&) = default; - /** Default destructor */ - virtual ~NETransposeConvLayer() = default; - - /** Set the input, weights, biases and output tensors. - * - * @param[in,out] input Input tensor. 3 lower dimensions represent a single input, and an - * optional 4th dimension for batch of inputs. Data types supported: F32/F16/QASYMM8/QASYMM8_SIGNED. - * @param[in] weights The 4d weights with dimensions [width, height, IFM, OFM]. Data type - * supported: Same as @p input. - * @param[in] bias Optional, ignored if NULL. The biases have one dimension. Data type - * supported: Data types supported: S32 for QASYMM8 and QASYMM8_SIGNED input, F32 for F32 input, F16 - * for F16 input. - * @param[out] output Output tensor. The output has the same number of dimensions as the @p - * input. - * @param[in] info Contains padding and policies to be used in the deconvolution, this is - * decribed in @ref PadStrideInfo. - * @param[in] invalid_right The number of zeros added to right edge of the output. - * @param[in] invalid_bottom The number of zeros added to bottom edge of the output. - * - */ - void configure(ITensor *input, const ITensor *weights, const ITensor *bias, ITensor *output, - const PadStrideInfo &info, unsigned int invalid_right, - unsigned int invalid_bottom); - /** Static function to check if given info will lead to a valid configuration of @ref - * NETransposeConvLayer - * - * @param[in] input Input tensor info. 3 lower dimensions represent a single input, and an - * optional 4th dimension for batch of inputs. Data types supported: F32/F16/QASYMM8/QASYMM8_SIGNED. - * @param[in] weights The 4d weights info with dimensions [width, height, IFM, OFM]. Data type - * supported: Same as @p input. - * @param[in] bias (Optional) The biases have one dimension. Data type supported: Data types - * supported: S32 for QASYMM8 and QASYMM8_SIGNED input, F32 for F32 input, F16 for F16 input. - * @param[in] output Output tensor info. The output has the same number of dimensions as the @p - * input. - * @param[in] info Contains padding and policies to be used in the deconvolution, this is - * decribed in @ref PadStrideInfo. - * @param[in] innvalid_right The number of zeros added to right edge of the output. - * @param[in] invalid_bottom The number of zeros added to bottom edge of the output. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *weights, - const ITensorInfo *bias, const ITensorInfo *output, - const PadStrideInfo &info, unsigned int invalid_right, - unsigned int invalid_bottom); - - // Inherited methods overridden: - void run() override; - void prepare() override; - -private: - MemoryGroup _memory_group; - NEConvolutionLayer _conv_f; - CPPUpsample _upsample_f; - NEReverse _flip_weights; - Tensor _scaled_output; - Tensor _weights_flipped; - Tensor _flip_axis; - const ITensor *_original_weights; - ITensor *_input; - PadStrideInfo _info; - bool _is_prepared; -}; -} // arm_compute -#endif /* __ARM_COMPUTE_NETRANSPOSECONVLAYER_H__ */ |