xref: /aosp_15_r20/external/ComputeLibrary/arm_compute/dynamic_fusion/sketch/attributes/ResizeAttributes.h (revision c217d954acce2dbc11938adb493fc0abd69584f3)
1 /*
2  * Copyright (c) 2022 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 #ifndef ARM_COMPUTE_DYNAMIC_FUSION_SKETCH_ATTRIBUTES_RESIZEATTRIBUTES
26 #define ARM_COMPUTE_DYNAMIC_FUSION_SKETCH_ATTRIBUTES_RESIZEATTRIBUTES
27 
28 #include "arm_compute/core/PixelValue.h"
29 #include "arm_compute/core/Types.h"
30 #include <cstdint>
31 
32 namespace arm_compute
33 {
34 namespace experimental
35 {
36 namespace dynamic_fusion
37 {
38 /** Attributes are backend-agnostic parameters (in addition to the input/output tensors) of an operator.
39  */
40 
41 /** Resize attributes */
42 class ResizeAttributes
43 {
44 public:
45     /** Set output width */
46     ResizeAttributes &output_width(int32_t output_width);
47 
48     /** Get output width */
49     int32_t output_width() const;
50 
51     /** Set output height */
52     ResizeAttributes &output_height(int32_t output_height);
53 
54     /** Get output height */
55     int32_t output_height() const;
56 
57     /** Set interpolation policy */
58     ResizeAttributes &interpolation_policy(InterpolationPolicy interpolation_policy);
59 
60     /** Get interpolation policy */
61     InterpolationPolicy interpolation_policy() const;
62 
63     /** Set sampling policy */
64     ResizeAttributes &sampling_policy(SamplingPolicy sampling_policy);
65 
66     /** Get sampling policy */
67     SamplingPolicy sampling_policy() const;
68 
69     /** Set align corners */
70     ResizeAttributes &align_corners(bool align_corners);
71 
72     /** Get align corners */
73     bool align_corners() const;
74 
75 private:
76     int32_t             _output_width{};
77     int32_t             _output_height{};
78     InterpolationPolicy _interpolation_policy{ InterpolationPolicy::BILINEAR };
79     SamplingPolicy      _sampling_policy{ SamplingPolicy::CENTER };
80     bool                _align_corners{ false };
81 };
82 
83 } // namespace dynamic_fusion
84 } // namespace experimental
85 } // namespace arm_compute
86 
87 #endif /* ARM_COMPUTE_DYNAMIC_FUSION_SKETCH_ATTRIBUTES_RESIZEATTRIBUTES */
88