Compute Library
 23.08
fp32.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-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  */
26 #include "arm_compute/core/Types.h"
30 
31 namespace arm_compute
32 {
33 namespace cpu
34 {
35 namespace
36 {
37 void pooling2_f32_maxpool_indices(const ITensor *src, ITensor *dst0, ITensor *dst1, PoolingLayerInfo &pool_info, const Window &window_src, const Window &window)
38 {
39  const int window_start_x = window.x().start();
40  const int window_end_x = window.x().end();
41  const int window_step_x = 4;
42 
43  Window window_out = window;
44  window_out.set(Window::DimX, Window::Dimension(0, 1, 1));
45 
46  Iterator in(src, window_src);
47  Iterator out(dst0, window_out);
48  Iterator indices(dst1, window_out);
49 
50  const int pool_pad_top = pool_info.pad_stride_info.pad_top();
51  const int pool_pad_left = pool_info.pad_stride_info.pad_left();
52 
53  int pool_stride_x = 0;
54  int pool_stride_y = 0;
55  std::tie(pool_stride_x, pool_stride_y) = pool_info.pad_stride_info.stride();
56 
57  float32x4_t vres;
58  float res;
59 
60  const int pad_right = src->info()->padding().right;
61  const int pad_left = src->info()->padding().left;
62  const int pad_horizontal = pad_right + pad_left;
63  const int in_stride_y = static_cast<int>(src->info()->strides_in_bytes().y());
64  const int in_stride_z = static_cast<int>(src->info()->strides_in_bytes().z());
65 
66  execute_window_loop(window_out, [&](const Coordinates & id)
67  {
68  const int idx_width = id.y() * pool_stride_x;
69  const int idx_height = id.z() * pool_stride_y;
70  const int pool_limit_y = pool_pad_top - idx_height;
71  const int pool_limit_x = pool_pad_left - idx_width;
72 
73  const int pool_start_y = std::max(0, window_src.z().start() + pool_limit_y);
74  const int pool_start_x = std::max(0, window_src.y().start() + pool_limit_x);
75 
76  const int in_x0_offset = (pool_start_x - pool_pad_left) * static_cast<int>(src->info()->strides_in_bytes().y()) + (pool_start_y - pool_pad_top) * static_cast<int>(src->info()->strides_in_bytes().z());
77  const int in_x1_offset = (pool_start_x + 1 - pool_pad_left) * static_cast<int>(src->info()->strides_in_bytes().y()) + (pool_start_y - pool_pad_top) * static_cast<int>
78  (src->info()->strides_in_bytes().z());
79  const int in_x2_offset = (pool_start_x - pool_pad_left) * static_cast<int>(src->info()->strides_in_bytes().y()) + (pool_start_y + 1 - pool_pad_top) * static_cast<int>
80  (src->info()->strides_in_bytes().z());
81  const int in_x3_offset = (pool_start_x + 1 - pool_pad_left) * static_cast<int>(src->info()->strides_in_bytes().y()) + (pool_start_y + 1 - pool_pad_top) * static_cast<int>
82  (src->info()->strides_in_bytes().z());
83 
84  int x_off = window_start_x;
85  for(; x_off <= (window_end_x - window_step_x); x_off += window_step_x)
86  {
87  const auto in_x0_ptr = reinterpret_cast<const float *>(in.ptr() + in_x0_offset);
88  const auto in_x1_ptr = reinterpret_cast<const float *>(in.ptr() + in_x1_offset);
89  const auto in_x2_ptr = reinterpret_cast<const float *>(in.ptr() + in_x2_offset);
90  const auto in_x3_ptr = reinterpret_cast<const float *>(in.ptr() + in_x3_offset);
91  const auto v_x0 = vld1q_f32(in_x0_ptr + x_off);
92  const auto v_x1 = vld1q_f32(in_x1_ptr + x_off);
93  const auto v_x2 = vld1q_f32(in_x2_ptr + x_off);
94  const auto v_x3 = vld1q_f32(in_x3_ptr + x_off);
95  vres = vmaxq_f32(vmaxq_f32(v_x2, v_x3), vmaxq_f32(v_x0, v_x1));
96  // Store result
97  vst1q_f32(reinterpret_cast<float *>(out.ptr()) + x_off, vres);
98 
99  const uint32_t offset_base = offset_no_padding<float>(in.offset(), id, *src->info(), pool_stride_x, pool_stride_y, DataLayout::NHWC);
100  const uint32_t offset_x0 = offset_base / sizeof(float) + x_off;
101  const uint32_t offset_x1 = offset_x0 + in_stride_y / sizeof(float) - pad_horizontal;
102  const uint32_t offset_x2 = offset_x0 + in_stride_z / sizeof(float) - pad_horizontal * src->info()->tensor_shape()[1];
103  const uint32_t offset_x3 = offset_x2 + in_stride_y / sizeof(float) - pad_horizontal;
104  const uint32x4_t voffset_x0 = { offset_x0, offset_x0 + 1, offset_x0 + 2, offset_x0 + 3 };
105  const uint32x4_t voffset_x1 = { offset_x1, offset_x1 + 1, offset_x1 + 2, offset_x1 + 3 };
106  const uint32x4_t voffset_x2 = { offset_x2, offset_x2 + 1, offset_x2 + 2, offset_x2 + 3 };
107  const uint32x4_t voffset_x3 = { offset_x3, offset_x3 + 1, offset_x3 + 2, offset_x3 + 3 };
108  const uint32x4_t tmp_indices0 = vbslq_u32(vcgeq_f32(v_x0, v_x1), voffset_x0, voffset_x1);
109  const uint32x4_t tmp_indices1 = vbslq_u32(vcgeq_f32(v_x2, v_x3), voffset_x2, voffset_x3);
110  const uint32x4_t tmp_indices2 = vbslq_u32(vcgeq_f32(vmaxq_f32(v_x0, v_x1), vmaxq_f32(v_x2, v_x3)), tmp_indices0, tmp_indices1);
111 
112  // Store indices
113  vst1q_u32(reinterpret_cast<uint32_t *>(indices.ptr()) + x_off, tmp_indices2);
114  }
115 
116  // Left-overs loop
117  for(; x_off < window_end_x; ++x_off)
118  {
119  const auto x0 = *(reinterpret_cast<const float *>(in.ptr() + in_x0_offset) + x_off);
120  const auto x1 = *(reinterpret_cast<const float *>(in.ptr() + in_x1_offset) + x_off);
121  const auto x2 = *(reinterpret_cast<const float *>(in.ptr() + in_x2_offset) + x_off);
122  const auto x3 = *(reinterpret_cast<const float *>(in.ptr() + in_x3_offset) + x_off);
123  res = std::max(std::max(x2, x3), std::max(x0, x1));
124 
125  // Store result
126  *(reinterpret_cast<float *>(out.ptr()) + x_off) = res;
127 
128  const uint32_t offset_base = offset_no_padding<float>(in.offset(), id, *src->info(), pool_stride_x, pool_stride_y, DataLayout::NHWC);
129  const uint32_t offset_x0 = offset_base / sizeof(float) + x_off;
130  const uint32_t offset_x1 = offset_x0 + in_stride_y / sizeof(float) - pad_horizontal;
131  const uint32_t offset_x2 = offset_x0 + in_stride_z / sizeof(float) - pad_horizontal * src->info()->tensor_shape()[1];
132  const uint32_t offset_x3 = offset_x2 + in_stride_y / sizeof(float) - pad_horizontal;
133  const uint32_t tmp_idx0 = (x0 >= x1) ? offset_x0 : offset_x1;
134  const uint32_t tmp_idx1 = (x2 >= x3) ? offset_x2 : offset_x3;
135  const uint32_t tmp_idx2 = (std::max(x0, x1) >= std::max(x2, x3)) ? tmp_idx0 : tmp_idx1;
136 
137  // Store indices
138  *(reinterpret_cast<uint32_t *>(indices.ptr()) + x_off) = tmp_idx2;
139  }
140  },
141  in, out, indices);
142 }
143 } // namespace
144 
145 void poolingMxN_fp32_neon_nhwc_kernel_indices(const ITensor *src, ITensor *dst0, ITensor *dst1, const PoolingLayerInfo &pool_info, const Window &window)
146 {
147  const int window_start_x = window.x().start();
148  const int window_end_x = window.x().end();
149  constexpr int window_step_x = 4;
150 
151  Window window_out = window;
152  window_out.set(Window::DimX, Window::Dimension(0, 1, 1));
153 
154  Iterator out(dst0, window_out);
155  Iterator indices(dst1, window_out);
156 
157  const int pool_size_x = pool_info.is_global_pooling ? src->info()->tensor_shape().y() : pool_info.pool_size.width;
158  const int pool_size_y = pool_info.is_global_pooling ? src->info()->tensor_shape().z() : pool_info.pool_size.height;
159 
160  const int pool_pad_top = pool_info.pad_stride_info.pad_top();
161  const int pool_pad_left = pool_info.pad_stride_info.pad_left();
162 
163  int pool_stride_x = 0;
164  int pool_stride_y = 0;
165  std::tie(pool_stride_x, pool_stride_y) = pool_info.pad_stride_info.stride();
166 
167  const float min_value = get_initial_min<float>(pool_info.use_inf_as_limit);
168 
169  float32x4_t vres;
170  uint32x4_t vidx;
171 
172  constexpr int idx_width = 1;
173  constexpr int idx_height = 2;
174  constexpr int idx_batch = 3;
175 
176  const int y_stride = static_cast<int>(src->info()->strides_in_bytes().y());
177  const int z_stride = static_cast<int>(src->info()->strides_in_bytes().z());
178  const int n_stride = static_cast<int>(src->info()->strides_in_bytes()[idx_batch]);
179 
180  const int input_dim_w = src->info()->dimension(idx_width);
181  const int input_dim_h = src->info()->dimension(idx_height);
182 
183  const uint8_t *in_ptr_start = src->buffer() + src->info()->offset_first_element_in_bytes();
184 
185  execute_window_loop(window_out, [&](const Coordinates & id)
186  {
187  const int idx_width = static_cast<int>(id.y()) * pool_stride_x - pool_pad_left;
188  const int idx_height = static_cast<int>(id.z()) * pool_stride_y - pool_pad_top;
189 
190  const int pool_start_x = std::max(0, -idx_width);
191  const int pool_start_y = std::max(0, -idx_height);
192 
193  const int pool_end_x = std::min(pool_size_x, input_dim_w - idx_width);
194  const int pool_end_y = std::min(pool_size_y, input_dim_h - idx_height);
195 
196  const uint8_t *in_ptr_n = in_ptr_start + id[idx_batch] * n_stride;
197 
198  const int in_ptr_y_offset = (z_stride * idx_height) + (pool_start_y * z_stride);
199  const int in_ptr_x_offset = (y_stride * idx_width) + (pool_start_x * y_stride);
200 
201  int x_off = window_start_x;
202 
203  for(; x_off <= (window_end_x - window_step_x); x_off += window_step_x)
204  {
205  vres = vdupq_n_f32(min_value);
206  vidx = vdupq_n_u32(0U);
207  const uint8_t *in_ptr_y = in_ptr_n + in_ptr_y_offset + in_ptr_x_offset;
208  uint32_t curr_kernel_index = pool_size_x * pool_start_y;
209  for(int y = pool_start_y; y < pool_end_y; ++y)
210  {
211  const uint8_t *in_ptr_x = in_ptr_y + (x_off * sizeof(float));
212  curr_kernel_index += pool_start_x;
213  for(int x = pool_start_x; x < pool_end_x; ++x)
214  {
215  const float32x4_t data = vld1q_f32(reinterpret_cast<const float *>(in_ptr_x));
216  const uint32x4_t vidx_curr = vdupq_n_u32(curr_kernel_index);
217  const uint32x4_t idxMask = vcgtq_f32(data, vres);
218  vidx = vbslq_u32(idxMask, vidx_curr, vidx);
219  vres = vmaxq_f32(vres, data);
220  in_ptr_x += y_stride;
221  curr_kernel_index++;
222  }
223  curr_kernel_index += (pool_size_x - pool_end_x);
224  in_ptr_y += z_stride;
225  }
226  // Store result
227  vst1q_f32(reinterpret_cast<float *>(out.ptr()) + x_off, vres);
228  vst1q_u32(reinterpret_cast<uint32_t *>(indices.ptr()) + x_off, vidx);
229  }
230 
231  // Left-overs loop
232  for(; x_off < window_end_x; ++x_off)
233  {
234  float res = min_value;
235  uint32_t idx = 0U;
236  const uint8_t *in_ptr_y = in_ptr_n + in_ptr_y_offset + in_ptr_x_offset;
237  for(int y = pool_start_y; y < pool_end_y; ++y)
238  {
239  const uint8_t *in_ptr_x = in_ptr_y + (x_off * sizeof(float));
240  for(int x = pool_start_x; x < pool_end_x; ++x)
241  {
242  const float data = *(reinterpret_cast<const float *>(in_ptr_x));
243  if(data > res)
244  {
245  idx = pool_size_x * y + x;
246  res = data;
247  }
248  in_ptr_x += y_stride;
249  }
250  in_ptr_y += z_stride;
251  }
252 
253  // Store result
254  *(reinterpret_cast<float *>(out.ptr()) + x_off) = res;
255  *(reinterpret_cast<uint32_t *>(indices.ptr()) + x_off) = idx;
256  }
257  },
258  out, indices);
259 }
260 
261 void poolingMxN_fp32_neon_nhwc(const ITensor *src, ITensor *dst0, ITensor *dst1, PoolingLayerInfo &pool_info, const Window &window_src, const Window &window)
262 {
263  if((pool_info.pool_type == PoolingType::MAX) && pool_info.use_kernel_indices && (dst1 != nullptr))
264  {
265  poolingMxN_fp32_neon_nhwc_kernel_indices(src, dst0, dst1, pool_info, window);
266  }
267  else if(pool_info.pool_size == Size2D(2, 2) && pool_info.pool_type == PoolingType::MAX && !pool_info.pad_stride_info.has_padding() && (dst1 != nullptr))
268  {
269  pooling2_f32_maxpool_indices(src, dst0, dst1, pool_info, window_src, window);
270  }
271  else
272  {
273  const int window_start_x = window.x().start();
274  const int window_end_x = window.x().end();
275  const int window_step_x = 4;
276 
277  Window window_out = window;
278  window_out.set(Window::DimX, Window::Dimension(0, 1, 1));
279 
280  Iterator in(src, window_src);
281  Iterator out(dst0, window_out);
282 
283  const int pool_size_x = pool_info.is_global_pooling ? src->info()->tensor_shape().y() : pool_info.pool_size.width;
284  const int pool_size_y = pool_info.is_global_pooling ? src->info()->tensor_shape().z() : pool_info.pool_size.height;
285  const int pool_pad_right = pool_info.pad_stride_info.pad_right();
286  const int pool_pad_top = pool_info.pad_stride_info.pad_top();
287  const int pool_pad_left = pool_info.pad_stride_info.pad_left();
288  const int pool_pad_bottom = pool_info.pad_stride_info.pad_bottom();
289  int pool_stride_x = 0;
290  int pool_stride_y = 0;
291  std::tie(pool_stride_x, pool_stride_y) = pool_info.pad_stride_info.stride();
292  const int upper_bound_w = src->info()->dimension(1) + (pool_info.exclude_padding ? 0 : pool_pad_right);
293  const int upper_bound_h = src->info()->dimension(2) + (pool_info.exclude_padding ? 0 : pool_pad_bottom);
294  const float min_value = get_initial_min<float>(pool_info.use_inf_as_limit);
295  float32x4_t vres;
296 
297  execute_window_loop(window_out, [&](const Coordinates & id)
298  {
299  const int idx_width = id.y() * pool_stride_x;
300  const int idx_height = id.z() * pool_stride_y;
301  const int pool_limit_y = pool_pad_top - idx_height;
302  const int pool_limit_x = pool_pad_left - idx_width;
303 
304  const int pool_start_y = std::max(0, window_src.z().start() + pool_limit_y);
305  const int pool_end_y = std::min(pool_size_y, window_src.z().end() + pool_limit_y);
306  const int pool_start_x = std::max(0, window_src.y().start() + pool_limit_x);
307  const int pool_end_x = std::min(pool_size_x, window_src.y().end() + pool_limit_x);
308 
309  int x_off = window_start_x;
310  for(; x_off <= (window_end_x - window_step_x); x_off += window_step_x)
311  {
312  if(pool_info.pool_type != PoolingType::MAX)
313  {
314  // Calculate scale
315  const float scale = calculate_avg_scale_pool2d(pool_info.exclude_padding, DataLayout::NHWC, id, pool_size_x, pool_size_y, upper_bound_w, upper_bound_h, pool_pad_left, pool_pad_top, pool_stride_x,
316  pool_stride_y);
317  const float32x4_t scale_v = vdupq_n_f32(scale);
318 
319  // Perform pooling
320  vres = vdupq_n_f32(0.0f);
321 
322  for(int y = pool_start_y; y < pool_end_y; ++y)
323  {
324  for(int x = pool_start_x; x < pool_end_x; ++x)
325  {
326  const float32x4_t data = vld1q_f32(reinterpret_cast<const float *>(in.ptr() + (x - pool_pad_left) * static_cast<int>(src->info()->strides_in_bytes().y()) + (y - pool_pad_top) * static_cast<int>
327  (src->info()->strides_in_bytes().z())) + x_off);
328 
329  // Get power of 2 in case of l2 pooling and accumulate
330  if(pool_info.pool_type == PoolingType::L2)
331  {
332  vres = vmlaq_f32(vres, data, data);
333  }
334  else
335  {
336  vres = vaddq_f32(vres, data);
337  }
338  }
339  }
340  // Divide by scale
341  vres = vmulq_f32(vres, scale_v);
342  }
343  else
344  {
345  vres = vdupq_n_f32(min_value);
346  for(int y = pool_start_y; y < pool_end_y; ++y)
347  {
348  for(int x = pool_start_x; x < pool_end_x; ++x)
349  {
350  const float32x4_t data = vld1q_f32(reinterpret_cast<const float *>(in.ptr() + (x - pool_pad_left) * static_cast<int>(src->info()->strides_in_bytes().y()) + (y - pool_pad_top) * static_cast<int>
351  (src->info()->strides_in_bytes().z())) + x_off);
352  vres = vmaxq_f32(vres, data);
353  }
354  }
355  }
356 
357  // Calculate square-root in case of l2 pooling
358  if(pool_info.pool_type == PoolingType::L2)
359  {
360  float32x4_t l2_res = { static_cast<float>(sqrt(vgetq_lane_f32(vres, 0))),
361  static_cast<float>(sqrt(vgetq_lane_f32(vres, 1))),
362  static_cast<float>(sqrt(vgetq_lane_f32(vres, 2))),
363  static_cast<float>(sqrt(vgetq_lane_f32(vres, 3)))
364  };
365  vres = l2_res;
366  }
367 
368  // Store result
369  vst1q_f32(reinterpret_cast<float *>(out.ptr()) + x_off, vres);
370  }
371 
372  // Left-overs loop
373  for(; x_off < window_end_x; ++x_off)
374  {
375  float res = 0.0f;
376 
377  if(pool_info.pool_type != PoolingType::MAX)
378  {
379  // Calculate scale
380  const float scale = calculate_avg_scale_pool2d(pool_info.exclude_padding, DataLayout::NHWC, id, pool_size_x, pool_size_y, upper_bound_w, upper_bound_h, pool_pad_left, pool_pad_top, pool_stride_x,
381  pool_stride_y);
382 
383  for(int y = pool_start_y; y < pool_end_y; ++y)
384  {
385  for(int x = pool_start_x; x < pool_end_x; ++x)
386  {
387  const float data = *(reinterpret_cast<const float *>(in.ptr() + (x - pool_pad_left) * static_cast<int>(src->info()->strides_in_bytes().y()) + (y - pool_pad_top) * static_cast<int>
388  (src->info()->strides_in_bytes().z())) + x_off);
389 
390  // Get power of 2 in case of l2 pooling and accumulate
391  if(pool_info.pool_type == PoolingType::L2)
392  {
393  res += data * data;
394  }
395  else
396  {
397  res += data;
398  }
399  }
400  }
401 
402  // Divide by scale
403  res *= scale;
404  }
405  else
406  {
407  res = min_value;
408  for(int y = pool_start_y; y < pool_end_y; ++y)
409  {
410  for(int x = pool_start_x; x < pool_end_x; ++x)
411  {
412  const float data = *(reinterpret_cast<const float *>(in.ptr() + (x - pool_pad_left) * static_cast<int>(src->info()->strides_in_bytes().y()) + (y - pool_pad_top) * static_cast<int>
413  (src->info()->strides_in_bytes().z())) + x_off);
414  res = std::max(res, data);
415  }
416  }
417  }
418 
419  // Calculate square-root in case of l2 pooling
420  if(pool_info.pool_type == PoolingType::L2)
421  {
422  res = std::sqrt(res);
423  }
424 
425  // Store result
426  *(reinterpret_cast<float *>(out.ptr()) + x_off) = res;
427  }
428  },
429  in, out);
430  }
431 }
432 } // namespace cpu
433 } // namespace arm_compute
arm_compute::PoolingLayerInfo::use_kernel_indices
bool use_kernel_indices
Definition: Types.h:1127
arm_compute::Window::Dimension::start
constexpr int start() const
Return the start of the dimension.
Definition: Window.h:97
arm_compute::test::validation::src
SimpleTensor< float > src
Definition: DFT.cpp:155
arm_compute::PoolingType::L2
@ L2
L2 Pooling.
arm_compute::test::validation::idx_height
const int idx_height
Definition: Scale.cpp:263
Helpers.h
arm_compute::PadStrideInfo::pad_right
unsigned int pad_right() const
Get the right padding.
Definition: CoreTypes.h:217
arm_compute::DataLayout::NHWC
@ NHWC
Num samples, height, width, channels.
arm_compute::PoolingLayerInfo::exclude_padding
bool exclude_padding
Definition: Types.h:1123
Types.h
arm_compute::Window::DimX
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
Definition: Window.h:43
intrinsics.h
arm_compute::Size2D
Class for specifying the size of an image or rectangle.
Definition: Size2D.h:34
arm_compute::Size2D::height
size_t height
Height of the image region or rectangle.
Definition: Size2D.h:91
arm_compute::ITensor
Interface for CPU tensor.
Definition: ITensor.h:36
arm_compute::PoolingLayerInfo::pool_size
Size2D pool_size
Definition: Types.h:1120
arm_compute::PadStrideInfo::has_padding
bool has_padding() const
Check whether this has any padding.
Definition: CoreTypes.h:239
arm_compute::test::validation::idx_width
const int idx_width
Definition: Scale.cpp:262
arm_compute::PoolingLayerInfo::use_inf_as_limit
bool use_inf_as_limit
Definition: Types.h:1126
arm_compute::utils::cast::U
U
Definition: SaturateCast.h:64
arm_compute::Iterator::ptr
constexpr uint8_t * ptr() const
Return a pointer to the current pixel.
Definition: Helpers.inl:149
list.h
arm_compute::Size2D::width
size_t width
Width of the image region or rectangle.
Definition: Size2D.h:90
arm_compute::Iterator
Iterator updated by execute_window_loop for each window element.
Definition: Helpers.h:46
arm_compute::PoolingLayerInfo
Pooling Layer Information struct.
Definition: Types.h:1018
WindowHelpers.h
arm_compute::Window::y
constexpr const Dimension & y() const
Alias to access the second dimension of the window.
Definition: Window.h:168
arm_compute::Coordinates
Coordinates of an item.
Definition: Coordinates.h:37
arm_compute::Window::Dimension
Describe one of the image's dimensions with a start, end and step.
Definition: Window.h:79
arm_compute::Window::set
void set(size_t dimension, const Dimension &dim)
Set the values of a given dimension.
Definition: Window.inl:49
arm_compute::PadStrideInfo::pad_left
unsigned int pad_left() const
Get the left padding.
Definition: CoreTypes.h:212
arm_compute::PoolingType::MAX
@ MAX
Max Pooling.
arm_compute::PadStrideInfo::pad_bottom
unsigned int pad_bottom() const
Get the bottom padding.
Definition: CoreTypes.h:227
arm_compute::PoolingLayerInfo::is_global_pooling
bool is_global_pooling
Definition: Types.h:1124
arm_compute::Window
Describe a multidimensional execution window.
Definition: Window.h:39
arm_compute::cpu::poolingMxN_fp32_neon_nhwc_kernel_indices
void poolingMxN_fp32_neon_nhwc_kernel_indices(const ITensor *src, ITensor *dst0, ITensor *dst1, const PoolingLayerInfo &pool_info, const Window &window)
Definition: fp32.cpp:145
arm_compute::test::validation::scale
NEScale scale
Definition: Scale.cpp:272
arm_compute
Copyright (c) 2017-2023 Arm Limited.
Definition: introduction.dox:24
arm_compute::cpu::poolingMxN_fp32_neon_nhwc
void poolingMxN_fp32_neon_nhwc(const ITensor *src, ITensor *dst0, ITensor *dst1, PoolingLayerInfo &pool_info, const Window &window_src, const Window &window)
Definition: fp32.cpp:261
ITensor.h
arm_compute::execute_window_loop
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77
arm_compute::Window::Dimension::end
constexpr int end() const
Return the end of the dimension.
Definition: Window.h:102
arm_compute::PoolingLayerInfo::pad_stride_info
PadStrideInfo pad_stride_info
Definition: Types.h:1122
arm_compute::PoolingLayerInfo::pool_type
PoolingType pool_type
Definition: Types.h:1119
arm_compute::Window::x
constexpr const Dimension & x() const
Alias to access the first dimension of the window.
Definition: Window.h:159
arm_compute::PadStrideInfo::pad_top
unsigned int pad_top() const
Get the top padding.
Definition: CoreTypes.h:222
arm_compute::PadStrideInfo::stride
std::pair< unsigned int, unsigned int > stride() const
Get the stride.
Definition: CoreTypes.h:186
arm_compute::Window::z
constexpr const Dimension & z() const
Alias to access the third dimension of the window.
Definition: Window.h:177