Pablo Marquez Tello | e5362e7 | 2023-10-16 14:14:14 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2022-2023 Arm Limited. |
| 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to |
| 8 | * deal in the Software without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in all |
| 14 | * copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
| 24 | |
| 25 | #include "src/cpu/kernels/directconv2d/impl.h" |
| 26 | #include "src/cpu/kernels/directconv2d/nchw/impl.h" |
| 27 | |
| 28 | namespace arm_compute |
| 29 | { |
| 30 | namespace cpu |
| 31 | { |
| 32 | namespace kernels |
| 33 | { |
| 34 | void run_im2col_fp16_pad(const ITensor *src, |
| 35 | ITensor *dst, |
| 36 | const Window &window, |
| 37 | DataLayout data_layout, |
| 38 | const PadStrideInfo &conv_info, |
| 39 | std::pair<unsigned int, unsigned int> convolved_dims, |
| 40 | const Size2D &kernel_dims, |
| 41 | const Size2D &dilation, |
| 42 | uint32_t input_pad_right, |
| 43 | bool has_bias) |
| 44 | { |
| 45 | #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(ENABLE_FP16_KERNELS) |
| 46 | arm_compute::cpu::kernels::run_im2col<float16_t, true, false>( |
| 47 | src, dst, window, data_layout, conv_info, convolved_dims, kernel_dims, dilation, input_pad_right, has_bias); |
| 48 | #else // defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(ENABLE_FP16_KERNELS) |
| 49 | ARM_COMPUTE_UNUSED(src, dst, window, data_layout, conv_info, convolved_dims, kernel_dims, dilation, input_pad_right, |
| 50 | has_bias); |
| 51 | #endif // defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(ENABLE_FP16_KERNELS) |
| 52 | } |
| 53 | |
| 54 | void run_im2col_fp16_nopad(const ITensor *src, |
| 55 | ITensor *dst, |
| 56 | const Window &window, |
| 57 | DataLayout data_layout, |
| 58 | const PadStrideInfo &conv_info, |
| 59 | std::pair<unsigned int, unsigned int> convolved_dims, |
| 60 | const Size2D &kernel_dims, |
| 61 | const Size2D &dilation, |
| 62 | uint32_t input_pad_right, |
| 63 | bool has_bias) |
| 64 | { |
| 65 | #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(ENABLE_FP16_KERNELS) |
| 66 | arm_compute::cpu::kernels::run_im2col<float16_t, false, false>( |
| 67 | src, dst, window, data_layout, conv_info, convolved_dims, kernel_dims, dilation, input_pad_right, has_bias); |
| 68 | #else // defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(ENABLE_FP16_KERNELS) |
| 69 | ARM_COMPUTE_UNUSED(src, dst, window, data_layout, conv_info, convolved_dims, kernel_dims, dilation, input_pad_right, |
| 70 | has_bias); |
| 71 | #endif // defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(ENABLE_FP16_KERNELS) |
| 72 | } |
| 73 | } // namespace kernels |
| 74 | } // namespace cpu |
| 75 | } // namespace arm_compute |