Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 1 | /* |
Michalis Spyrou | 9f15c5e | 2019-04-03 19:48:54 +0100 | [diff] [blame] | 2 | * Copyright (c) 2017-2019 ARM Limited. |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 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 | #ifndef __ARM_COMPUTE_NEDEPTHCONCATENATE_H__ |
| 25 | #define __ARM_COMPUTE_NEDEPTHCONCATENATE_H__ |
| 26 | |
| 27 | #include "arm_compute/runtime/IFunction.h" |
| 28 | |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 29 | #include "arm_compute/core/NEON/kernels/NEDepthConcatenateLayerKernel.h" |
Georgios Pinitas | ac4e873 | 2017-07-05 17:02:25 +0100 | [diff] [blame] | 30 | #include "arm_compute/core/NEON/kernels/NEFillBorderKernel.h" |
| 31 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 32 | #include <memory> |
| 33 | #include <vector> |
| 34 | |
| 35 | namespace arm_compute |
| 36 | { |
| 37 | class ITensor; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 38 | |
| 39 | /** Basic function to execute concatenate tensors along z axis. This function calls the following kernels: |
| 40 | * |
| 41 | * -# @ref NEFillBorderKernel (executed if input's lowest two dimensions are smaller than respective output's dimensions) |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 42 | * -# @ref NEDepthConcatenateLayerKernel |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 43 | * |
Michalis Spyrou | 9f15c5e | 2019-04-03 19:48:54 +0100 | [diff] [blame] | 44 | * @deprecated This function is deprecated and will be removed in release 19.08 |
| 45 | * |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 46 | */ |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 47 | class NEDepthConcatenateLayer : public IFunction |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 48 | { |
| 49 | public: |
| 50 | /** Default constructor */ |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 51 | NEDepthConcatenateLayer(); |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 52 | /** Initialise the kernel's inputs vector and output. |
| 53 | * |
Georgios Pinitas | ae54e02 | 2018-07-16 15:41:27 +0100 | [diff] [blame] | 54 | * @param[in,out] inputs_vector The vectors containing all the tensors to concatenate. Data types supported: QASYMM8/F16/F32. |
| 55 | * Input dimensions might differ for each input for the first three dimensions (width, height, depth) |
| 56 | * and must match for the rest. |
| 57 | * Note that the difference between the minimum and maximum width and height among the input tensors |
| 58 | * must be divisible by 2 otherwise it is not clear how padding should be added on the inputs' width and |
| 59 | * height when they are less than the maximum input sizes. |
| 60 | * @param[out] output Output tensor. Data types supported: Same as @p input. |
| 61 | * Output tensor dimensions match the inputs' ones from the fourth dimension and above, |
| 62 | * while width and height are the maximum width and height of the input tensors. |
| 63 | * Finally, depth is the sum of the input depths. |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 64 | */ |
Georgios Pinitas | ae54e02 | 2018-07-16 15:41:27 +0100 | [diff] [blame] | 65 | void configure(const std::vector<ITensor *> &inputs_vector, ITensor *output); |
| 66 | /** Static function to check if given info will lead to a valid configuration of @ref NEDepthConcatenateLayer |
| 67 | * |
| 68 | * @param[in] inputs_vector The vectors containing all the tensors to concatenate. Data types supported: QASYMM8/F16/F32. |
| 69 | * Input dimensions might differ for each input for the first three dimensions (width, height, depth) |
| 70 | * and must match for the rest. |
| 71 | * Note that the difference between the minimum and maximum width and height among the input tensors |
| 72 | * must be divisible by 2 otherwise it is not clear how padding should be added on the inputs' width and |
| 73 | * height when they are less than the maximum input sizes. |
| 74 | * @param[in] output Output tensor. Data types supported: Same as @p input. |
| 75 | * Output tensor dimensions match the inputs' ones from the fourth dimension and above, |
| 76 | * while width and height are the maximum width and height of the input tensors. |
| 77 | * Finally, depth is the sum of the input depths. |
| 78 | * |
| 79 | * @return a status |
| 80 | */ |
| 81 | static Status validate(const std::vector<ITensorInfo *> &inputs_vector, const ITensorInfo *output); |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 82 | |
| 83 | // Inherited methods overridden: |
| 84 | void run() override; |
| 85 | |
| 86 | private: |
Michalis Spyrou | 299fdd3 | 2019-05-01 13:03:59 +0100 | [diff] [blame] | 87 | std::vector<ITensor *> _inputs_vector; |
| 88 | std::vector<std::unique_ptr<NEDepthConcatenateLayerKernel>> _concat_kernels_vector; |
| 89 | std::vector<std::unique_ptr<NEFillBorderKernel>> _border_handlers_vector; |
| 90 | unsigned int _num_inputs; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 91 | }; |
Georgios Pinitas | 9e4824c | 2019-04-12 13:15:58 +0100 | [diff] [blame] | 92 | } // namespace arm_compute |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 93 | #endif /* __ARM_COMPUTE_NEDEPTHCONCATENATE_H__ */ |