Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 1 | /* |
Georgios Pinitas | 5a59453 | 2018-12-03 14:30:05 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2019 ARM Limited. |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [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 | #include "arm_compute/core/NEON/kernels/NEGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel.h" |
| 25 | |
| 26 | #include "arm_compute/core/AccessWindowStatic.h" |
| 27 | #include "arm_compute/core/Error.h" |
| 28 | #include "arm_compute/core/Helpers.h" |
| 29 | #include "arm_compute/core/ITensor.h" |
| 30 | #include "arm_compute/core/NEON/NEAsymm.h" |
Georgios Pinitas | 932491f | 2018-09-21 16:33:15 +0100 | [diff] [blame] | 31 | #include "arm_compute/core/TensorInfo.h" |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 32 | #include "arm_compute/core/Types.h" |
| 33 | #include "arm_compute/core/Utils.h" |
| 34 | #include "arm_compute/core/Validate.h" |
| 35 | #include "arm_compute/core/Window.h" |
Georgios Pinitas | 041f36d | 2018-09-18 18:38:37 +0100 | [diff] [blame] | 36 | #include "arm_compute/core/utils/misc/ShapeCalculator.h" |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 37 | |
| 38 | #include <arm_neon.h> |
| 39 | #include <cstddef> |
| 40 | #include <cstdint> |
| 41 | |
| 42 | using namespace arm_compute; |
| 43 | |
| 44 | namespace |
| 45 | { |
Georgios Pinitas | bb081ca | 2018-11-08 10:22:01 +0000 | [diff] [blame] | 46 | Status validate_arguments(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, int min, int max) |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 47 | { |
| 48 | ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::S32); |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 49 | ARM_COMPUTE_RETURN_ERROR_ON(max > 255); |
| 50 | ARM_COMPUTE_RETURN_ERROR_ON(min < 0 || min > max); |
| 51 | |
| 52 | // Check biases if exist |
| 53 | if(bias != nullptr) |
| 54 | { |
| 55 | ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, bias); |
| 56 | ARM_COMPUTE_RETURN_ERROR_ON(bias->num_dimensions() > 1); |
| 57 | ARM_COMPUTE_RETURN_ERROR_ON(input->dimension(0) != bias->dimension(0)); |
| 58 | } |
Chunosov | 5124be5 | 2017-11-22 20:42:13 +0700 | [diff] [blame] | 59 | |
| 60 | if(output->total_size() != 0) |
| 61 | { |
| 62 | ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::QASYMM8); |
Georgios Pinitas | bb081ca | 2018-11-08 10:22:01 +0000 | [diff] [blame] | 63 | ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(output, input); |
Chunosov | 5124be5 | 2017-11-22 20:42:13 +0700 | [diff] [blame] | 64 | } |
| 65 | |
Georgios Pinitas | 631c41a | 2017-12-06 11:53:03 +0000 | [diff] [blame] | 66 | return Status{}; |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 67 | } |
| 68 | |
Georgios Pinitas | 5a59453 | 2018-12-03 14:30:05 +0000 | [diff] [blame] | 69 | std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITensorInfo *output) |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 70 | { |
Georgios Pinitas | bb081ca | 2018-11-08 10:22:01 +0000 | [diff] [blame] | 71 | // Output auto inizialitation if not yet initialized |
| 72 | auto_init_if_empty(*output, input->clone()->set_data_type(DataType::QASYMM8)); |
| 73 | |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 74 | // Configure kernel window |
Georgios Pinitas | 5a59453 | 2018-12-03 14:30:05 +0000 | [diff] [blame] | 75 | Window win = calculate_max_window(*input, Steps()); |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 76 | |
Georgios Pinitas | 5a59453 | 2018-12-03 14:30:05 +0000 | [diff] [blame] | 77 | // NEGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel doesn't need padding so update_window_and_padding() can be skipped |
| 78 | Coordinates coord; |
| 79 | coord.set_num_dimensions(output->num_dimensions()); |
| 80 | output->set_valid_region(ValidRegion(coord, output->tensor_shape())); |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 81 | |
Georgios Pinitas | 5a59453 | 2018-12-03 14:30:05 +0000 | [diff] [blame] | 82 | return std::make_pair(Status{}, win); |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 83 | } |
Georgios Pinitas | f72f936 | 2018-01-12 16:29:45 +0000 | [diff] [blame] | 84 | } // namespace |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 85 | |
Georgios Pinitas | f72f936 | 2018-01-12 16:29:45 +0000 | [diff] [blame] | 86 | namespace arm_compute |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 87 | { |
Georgios Pinitas | f72f936 | 2018-01-12 16:29:45 +0000 | [diff] [blame] | 88 | class Coordinates; |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 89 | |
| 90 | /* Function used by the left-over for loop to perform the quantization */ |
| 91 | template <bool is_bounded_relu> |
| 92 | inline uint8_t finalize_quantization(int32x4_t in_s32, int result_fixedpoint_multiplier, int32_t result_shift, int32x4_t result_offset_after_shift_s32, uint8_t min_u8, uint8_t max_u8) |
| 93 | { |
| 94 | const static int32x4_t zero_s32 = vdupq_n_s32(0); |
| 95 | const static int32x4_t sat_value_s32 = vdupq_n_s32(255); |
| 96 | |
| 97 | // Fixed point multiplication with vector saturating rounding doubling multiply high with scalar |
| 98 | in_s32 = vqrdmulhq_n_s32(in_s32, result_fixedpoint_multiplier); |
| 99 | |
| 100 | // Round to the nearest division by a power-of-two using result_shift_s32 |
| 101 | in_s32 = rounding_divide_by_pow2(in_s32, result_shift); |
| 102 | |
| 103 | // Add the offset terms |
| 104 | in_s32 = vaddq_s32(in_s32, result_offset_after_shift_s32); |
| 105 | |
| 106 | // Saturate negative values |
| 107 | in_s32 = vmaxq_s32(in_s32, zero_s32); |
| 108 | in_s32 = vminq_s32(in_s32, sat_value_s32); |
| 109 | |
| 110 | auto out_u8 = static_cast<uint8_t>(vgetq_lane_s32(in_s32, 0)); |
| 111 | |
| 112 | if(is_bounded_relu) |
| 113 | { |
| 114 | out_u8 = std::max(out_u8, min_u8); |
| 115 | out_u8 = std::min(out_u8, max_u8); |
| 116 | } |
| 117 | |
| 118 | return out_u8; |
| 119 | } |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 120 | } // namespace arm_compute |
| 121 | |
| 122 | template <bool is_bounded_relu> |
| 123 | void NEGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel::run(const Window &window) |
| 124 | { |
| 125 | const int32x4_t result_offset_after_shift_s32 = vdupq_n_s32(_result_offset_after_shift); |
| 126 | const uint8x16_t min_u8 = vdupq_n_u8(static_cast<uint8_t>(_min)); |
| 127 | const uint8x16_t max_u8 = vdupq_n_u8(static_cast<uint8_t>(_max)); |
| 128 | |
| 129 | ARM_COMPUTE_UNUSED(min_u8); |
| 130 | ARM_COMPUTE_UNUSED(max_u8); |
| 131 | |
Georgios Pinitas | bb081ca | 2018-11-08 10:22:01 +0000 | [diff] [blame] | 132 | const int window_step_x = 16; |
| 133 | const auto window_start_x = static_cast<int>(window.x().start()); |
| 134 | const auto window_end_x = static_cast<int>(window.x().end()); |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 135 | |
Georgios Pinitas | 041f36d | 2018-09-18 18:38:37 +0100 | [diff] [blame] | 136 | Window win_collapsed = window.collapse_if_possible(window, Window::DimZ); |
| 137 | win_collapsed.set(Window::DimX, Window::Dimension(0, 1, 1)); |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 138 | |
Georgios Pinitas | 041f36d | 2018-09-18 18:38:37 +0100 | [diff] [blame] | 139 | Iterator in(_input, win_collapsed); |
Georgios Pinitas | bb081ca | 2018-11-08 10:22:01 +0000 | [diff] [blame] | 140 | Iterator out(_output, win_collapsed); |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 141 | if(_bias != nullptr) |
| 142 | { |
| 143 | Window win_biases; |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 144 | win_biases.set(Window::DimX, Window::Dimension(0, 1, 1)); |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 145 | win_biases.set(Window::DimY, Window::Dimension(0, 1, 1)); |
| 146 | |
| 147 | Iterator bias(_bias, win_biases); |
Georgios Pinitas | 041f36d | 2018-09-18 18:38:37 +0100 | [diff] [blame] | 148 | execute_window_loop(win_collapsed, [&](const Coordinates & id) |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 149 | { |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 150 | // Compute 16 elements per iteration |
| 151 | int x = window_start_x; |
| 152 | for(; x <= (window_end_x - window_step_x); x += window_step_x) |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 153 | { |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 154 | int32x4x4_t in_s32 = |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 155 | { |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 156 | { |
| 157 | vld1q_s32(reinterpret_cast<const int32_t *>(in.ptr()) + x + 0), |
| 158 | vld1q_s32(reinterpret_cast<const int32_t *>(in.ptr()) + x + 4), |
| 159 | vld1q_s32(reinterpret_cast<const int32_t *>(in.ptr()) + x + 8), |
| 160 | vld1q_s32(reinterpret_cast<const int32_t *>(in.ptr()) + x + 12) |
| 161 | } |
| 162 | }; |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 163 | |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 164 | const int32x4x4_t bias_s32 = |
| 165 | { |
| 166 | { |
| 167 | vld1q_s32(reinterpret_cast<const int32_t *>(bias.ptr()) + x + 0), |
| 168 | vld1q_s32(reinterpret_cast<const int32_t *>(bias.ptr()) + x + 4), |
| 169 | vld1q_s32(reinterpret_cast<const int32_t *>(bias.ptr()) + x + 8), |
| 170 | vld1q_s32(reinterpret_cast<const int32_t *>(bias.ptr()) + x + 12) |
| 171 | } |
| 172 | }; |
| 173 | |
| 174 | // Add the bias to GEMM's result |
| 175 | in_s32.val[0] = vaddq_s32(in_s32.val[0], bias_s32.val[0]); |
| 176 | in_s32.val[1] = vaddq_s32(in_s32.val[1], bias_s32.val[1]); |
| 177 | in_s32.val[2] = vaddq_s32(in_s32.val[2], bias_s32.val[2]); |
| 178 | in_s32.val[3] = vaddq_s32(in_s32.val[3], bias_s32.val[3]); |
| 179 | |
Georgios Pinitas | bb081ca | 2018-11-08 10:22:01 +0000 | [diff] [blame] | 180 | vst1q_u8(out.ptr() + x, finalize_quantization<is_bounded_relu>(in_s32, _result_fixedpoint_multiplier, _result_shift, result_offset_after_shift_s32, min_u8, max_u8)); |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 181 | } |
| 182 | |
| 183 | // Compute left-over elements |
| 184 | for(; x < window_end_x; ++x) |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 185 | { |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 186 | const int32_t bias_value = *(reinterpret_cast<const int32_t *>(bias.ptr()) + x); |
| 187 | int32_t in_value = *(reinterpret_cast<const int32_t *>(in.ptr()) + x); |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 188 | |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 189 | // Add bias |
| 190 | in_value += bias_value; |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 191 | |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 192 | // Finalize and store the result |
Georgios Pinitas | bb081ca | 2018-11-08 10:22:01 +0000 | [diff] [blame] | 193 | *(out.ptr() + x) = finalize_quantization<is_bounded_relu>(vdupq_n_s32(in_value), _result_fixedpoint_multiplier, _result_shift, result_offset_after_shift_s32, static_cast<uint8_t>(_min), |
| 194 | static_cast<uint8_t>(_max)); |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 195 | } |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 196 | }, |
Georgios Pinitas | bb081ca | 2018-11-08 10:22:01 +0000 | [diff] [blame] | 197 | in, out, bias); |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 198 | } |
| 199 | else |
| 200 | { |
Georgios Pinitas | 041f36d | 2018-09-18 18:38:37 +0100 | [diff] [blame] | 201 | execute_window_loop(win_collapsed, [&](const Coordinates & id) |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 202 | { |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 203 | // Compute 16 elements per iteration |
| 204 | int x = window_start_x; |
| 205 | for(; x <= (window_end_x - window_step_x); x += window_step_x) |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 206 | { |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 207 | int32x4x4_t in_s32 = |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 208 | { |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 209 | { |
| 210 | vld1q_s32(reinterpret_cast<const int32_t *>(in.ptr()) + x + 0), |
| 211 | vld1q_s32(reinterpret_cast<const int32_t *>(in.ptr()) + x + 4), |
| 212 | vld1q_s32(reinterpret_cast<const int32_t *>(in.ptr()) + x + 8), |
| 213 | vld1q_s32(reinterpret_cast<const int32_t *>(in.ptr()) + x + 12) |
| 214 | } |
| 215 | }; |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 216 | |
Georgios Pinitas | bb081ca | 2018-11-08 10:22:01 +0000 | [diff] [blame] | 217 | vst1q_u8(out.ptr() + x, finalize_quantization<is_bounded_relu>(in_s32, _result_fixedpoint_multiplier, _result_shift, result_offset_after_shift_s32, min_u8, max_u8)); |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | // Compute left-over elements |
| 221 | for(; x < window_end_x; ++x) |
| 222 | { |
| 223 | const int32x4_t in_s32 = vld1q_dup_s32(reinterpret_cast<const int32_t *>(in.ptr()) + x); |
| 224 | |
| 225 | // Finalize and store the result |
Georgios Pinitas | bb081ca | 2018-11-08 10:22:01 +0000 | [diff] [blame] | 226 | *(out.ptr() + x) = finalize_quantization<is_bounded_relu>(in_s32, _result_fixedpoint_multiplier, _result_shift, result_offset_after_shift_s32, static_cast<uint8_t>(_min), static_cast<uint8_t>(_max)); |
Gian Marco | 7f0f790 | 2017-12-07 09:26:56 +0000 | [diff] [blame] | 227 | } |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 228 | }, |
Georgios Pinitas | bb081ca | 2018-11-08 10:22:01 +0000 | [diff] [blame] | 229 | in, out); |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 230 | } |
| 231 | } |
| 232 | |
| 233 | NEGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel::NEGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel() |
Georgios Pinitas | bb081ca | 2018-11-08 10:22:01 +0000 | [diff] [blame] | 234 | : _func(nullptr), _input(nullptr), _bias(nullptr), _output(nullptr), _result_fixedpoint_multiplier(0), _result_shift(0), _result_offset_after_shift(0), _min(0), _max(0) |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 235 | { |
| 236 | } |
| 237 | |
| 238 | void NEGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel::configure(const ITensor *input, const ITensor *bias, ITensor *output, int result_fixedpoint_multiplier, int result_shift, |
Georgios Pinitas | bb081ca | 2018-11-08 10:22:01 +0000 | [diff] [blame] | 239 | int result_offset_after_shift, int min, int max) |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 240 | { |
| 241 | // Perform validate step |
| 242 | ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); |
Georgios Pinitas | bb081ca | 2018-11-08 10:22:01 +0000 | [diff] [blame] | 243 | ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), (bias != nullptr) ? bias->info() : nullptr, output->info(), min, max)); |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 244 | |
| 245 | _input = input; |
| 246 | _bias = bias; |
| 247 | _output = output; |
| 248 | _result_fixedpoint_multiplier = result_fixedpoint_multiplier; |
| 249 | _result_shift = result_shift; |
| 250 | _result_offset_after_shift = result_offset_after_shift; |
| 251 | _min = min; |
| 252 | _max = max; |
| 253 | |
| 254 | // Configure kernel window |
Georgios Pinitas | 5a59453 | 2018-12-03 14:30:05 +0000 | [diff] [blame] | 255 | auto win_config = validate_and_configure_window(input->info(), output->info()); |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 256 | ARM_COMPUTE_ERROR_THROW_ON(win_config.first); |
| 257 | INEKernel::configure(win_config.second); |
| 258 | |
| 259 | // Check if we need to clamp the result using min and max |
| 260 | const bool is_bounded_relu = ((min != max) && !(min == 0 && max == 255)); |
| 261 | _func = is_bounded_relu ? &NEGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel::run<true> : &NEGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel::run<false>; |
| 262 | } |
| 263 | |
Georgios Pinitas | bb081ca | 2018-11-08 10:22:01 +0000 | [diff] [blame] | 264 | Status NEGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel::validate(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, int min, int max) |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 265 | { |
Chunosov | 5124be5 | 2017-11-22 20:42:13 +0700 | [diff] [blame] | 266 | ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); |
Georgios Pinitas | bb081ca | 2018-11-08 10:22:01 +0000 | [diff] [blame] | 267 | ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, bias, output, min, max)); |
Georgios Pinitas | 5a59453 | 2018-12-03 14:30:05 +0000 | [diff] [blame] | 268 | ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), output->clone().get()).first); |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 269 | |
Georgios Pinitas | 631c41a | 2017-12-06 11:53:03 +0000 | [diff] [blame] | 270 | return Status{}; |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 271 | } |
| 272 | |
| 273 | void NEGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel::run(const Window &window, const ThreadInfo &info) |
| 274 | { |
| 275 | ARM_COMPUTE_UNUSED(info); |
| 276 | ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); |
| 277 | ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(INEKernel::window(), window); |
| 278 | |
| 279 | (this->*_func)(window); |
| 280 | } |