MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / scaled_dimensions

Function scaled_dimensions

src/core/Utils.cpp:288–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286}
287
288std::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
334std::pair<int, int> scaled_dimensions_signed(
335 int width, int height, int kernel_width, int kernel_height, const PadStrideInfo &pad_stride_info)

Callers 15

configureMethod · 0.85
validateMethod · 0.85
configure_opencl_kernelFunction · 0.85
configureMethod · 0.85
calculate_same_padFunction · 0.85
skip_im_col_infoMethod · 0.85
configureMethod · 0.85
has_opt_implMethod · 0.85

Calls 10

floorFunction · 0.85
ceilFunction · 0.85
pad_leftMethod · 0.80
pad_topMethod · 0.80
pad_rightMethod · 0.80
pad_bottomMethod · 0.80
xMethod · 0.45
yMethod · 0.45
strideMethod · 0.45
roundMethod · 0.45

Tested by

no test coverage detected