Debian Codegraph @

arm_compute/runtime/NEON/functions/NEBatchToSpaceLayer.h

raw
1 /*
2 * Copyright (c) 2019-2021, 2023-2024 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 #ifndef ACL_ARM_COMPUTE_RUNTIME_NEON_FUNCTIONS_NEBATCHTOSPACELAYER_H
25 #define ACL_ARM_COMPUTE_RUNTIME_NEON_FUNCTIONS_NEBATCHTOSPACELAYER_H
26
27 #include "arm_compute/core/Types.h"
28 #include "arm_compute/runtime/IFunction.h"
29 #include "arm_compute/runtime/NEON/INESimpleFunctionNoBorder.h"
30
31 namespace arm_compute
32 {
33 class ITensor;
34 class ITensorInfo;
35
36 /** Basic function to run NEBatchToSpaceLayerKernel. */
37 class NEBatchToSpaceLayer : public INESimpleFunctionNoBorder
38 {
39 public:
40 /** Constructor */
41 NEBatchToSpaceLayer() = default;
42 /** Prevent instances of this class from being copied (As this class contains pointers) */
43 NEBatchToSpaceLayer(const NEBatchToSpaceLayer &) = delete;
44 /** Prevent instances of this class from being copied (As this class contains pointers) */
45 NEBatchToSpaceLayer &operator=(const NEBatchToSpaceLayer &) = delete;
46 /** Prevent instances of this class from being moved (As this class contains non movable objects) */
47 NEBatchToSpaceLayer(NEBatchToSpaceLayer &&) = delete;
48 /** Prevent instances of this class from being moved (As this class contains non movable objects) */
49 NEBatchToSpaceLayer &operator=(NEBatchToSpaceLayer &&) = delete;
50 /** Default destructor */
51 ~NEBatchToSpaceLayer() = default;
52 /** Set the input and output tensors.
53 *
54 * Valid data layouts:
55 * - NHWC
56 * - NCHW
57 *
58 * Valid data type configurations:
59 * |src0 |src1 |dst |
60 * |:---------|:---------|:----------|
61 * |All |s32 |All |
62 *
63 * @param[in] input Tensor input. Supported tensor rank: 4. Data types supported: All.
64 * @param[in] block_shape 1-D tensor with shape [M]. Data types supported: S32
65 * @param[out] output Tensor output. Data types supported: same as @p input
66 *
67 * @deprecated This method for dynamic block shape is not fully mature and will be removed in 23.08 release
68 */
69 ARM_COMPUTE_DEPRECATED_REL(23.05)
70 void configure(const ITensor *input, const ITensor *block_shape, ITensor *output);
71 /** Set the input and output tensors. (Static block shape).
72 *
73 * @param[in] input Tensor input. Supported tensor rank: 4. Data types supported: All.
74 * @param[in] block_shape_x Block shape x value.
75 * @param[in] block_shape_y Block shape y value.
76 * @param[out] output Tensor output. Data types supported: same as @p input
77 * @param[in] crop_info Specifies how the output shape is cropped after batch to space is performed
78 */
79 void configure(const ITensor *input,
80 int32_t block_shape_x,
81 int32_t block_shape_y,
82 ITensor *output,
83 const CropInfo &crop_info = CropInfo{});
84 /** Static function to check if given info will lead to a valid configuration of @ref CLBatchToSpaceLayer
85 *
86 * @param[in] input Tensor input info. Supported tensor rank: 4. Data types supported: All.
87 * @param[in] block_shape block shape tensor info with shape [M]. Data types supported: S32
88 * @param[out] output Tensor output info. Data types supported: same as @p input
89 *
90 * @return a status
91 * @deprecated This method for dynamic block shape is not fully mature and will be removed in 23.08 release
92 */
93 ARM_COMPUTE_DEPRECATED_REL(23.05)
94 static Status validate(const ITensorInfo *input, const ITensorInfo *block_shape, const ITensorInfo *output);
95 /** Static function to check if given info will lead to a valid configuration of @ref CLBatchToSpaceLayer (Static block shape).
96 *
97 * @param[in] input Tensor input info. Supported tensor rank: 4. Data types supported: All.
98 * @param[in] block_shape_x Block shape x value.
99 * @param[in] block_shape_y Block shape y value.
100 * @param[out] output Tensor output info. Data types supported: same as @p input
101 * @param[in] crop_info Specifies how the output shape is cropped after batch to space is performed
102 *
103 * @return a status
104 */
105 static Status validate(const ITensorInfo *input,
106 int32_t block_shape_x,
107 int32_t block_shape_y,
108 const ITensorInfo *output,
109 const CropInfo &crop_info = CropInfo{});
110 };
111 } // namespace arm_compute
112 #endif // ACL_ARM_COMPUTE_RUNTIME_NEON_FUNCTIONS_NEBATCHTOSPACELAYER_H