| 286 | } |
| 287 | |
| 288 | std::pair<unsigned int, unsigned int> scaled_dimensions(int width, |
| 289 | int height, |
| 290 | int kernel_width, |
| 291 | int kernel_height, |
| 292 | const PadStrideInfo &pad_stride_info, |
| 293 | const Size2D &dilation) |
| 294 | { |
| 295 | const int dilation_x = dilation.x(); |
| 296 | const int dilation_y = dilation.y(); |
| 297 | const int pad_left = pad_stride_info.pad_left(); |
| 298 | const int pad_top = pad_stride_info.pad_top(); |
| 299 | const int pad_right = pad_stride_info.pad_right(); |
| 300 | const int pad_bottom = pad_stride_info.pad_bottom(); |
| 301 | const int stride_x = pad_stride_info.stride().first; |
| 302 | const int stride_y = pad_stride_info.stride().second; |
| 303 | int w = 0; |
| 304 | int h = 0; |
| 305 | switch (pad_stride_info.round()) |
| 306 | { |
| 307 | case DimensionRoundingType::FLOOR: |
| 308 | w = static_cast<int>(std::floor( |
| 309 | (static_cast<float>(width + pad_left + pad_right - (dilation_x * (kernel_width - 1) + 1)) / stride_x) + |
| 310 | 1)); |
| 311 | h = static_cast<int>( |
| 312 | std::floor((static_cast<float>(height + pad_top + pad_bottom - (dilation_y * (kernel_height - 1) + 1)) / |
| 313 | stride_y) + |
| 314 | 1)); |
| 315 | break; |
| 316 | case DimensionRoundingType::CEIL: |
| 317 | w = static_cast<int>(std::ceil( |
| 318 | (static_cast<float>(width + pad_left + pad_right - (dilation_x * (kernel_width - 1) + 1)) / stride_x) + |
| 319 | 1)); |
| 320 | h = static_cast<int>( |
| 321 | std::ceil((static_cast<float>(height + pad_top + pad_bottom - (dilation_y * (kernel_height - 1) + 1)) / |
| 322 | stride_y) + |
| 323 | 1)); |
| 324 | break; |
| 325 | default: |
| 326 | ARM_COMPUTE_ERROR("Unsupported rounding type"); |
| 327 | } |
| 328 | |
| 329 | w = std::max(1, w); |
| 330 | h = std::max(1, h); |
| 331 | return std::make_pair(static_cast<unsigned int>(w), static_cast<unsigned int>(h)); |
| 332 | } |
| 333 | |
| 334 | std::pair<int, int> scaled_dimensions_signed( |
| 335 | int width, int height, int kernel_width, int kernel_height, const PadStrideInfo &pad_stride_info) |
no test coverage detected