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

Function calculate_scale_factors

src/gpu/cl/kernels/ClScaleKernel.cpp:48–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46namespace
47{
48inline std::tuple<float, float>
49calculate_scale_factors(const ITensorInfo *src, const ITensorInfo *dst, DataLayout data_layout, bool align_corners)
50{
51 const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
52 const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
53
54 // Compute the ratio between source width/height and destination width/height
55 const unsigned int src_width = src->dimension(idx_width);
56 const unsigned int src_height = src->dimension(idx_height);
57 const unsigned int dst_width = dst->dimension(idx_width);
58 const unsigned int dst_height = dst->dimension(idx_height);
59
60 float scale_x = arm_compute::scale_utils::calculate_resize_ratio(src_width, dst_width, align_corners);
61 float scale_y = arm_compute::scale_utils::calculate_resize_ratio(src_height, dst_height, align_corners);
62
63 return std::make_tuple(scale_x, scale_y);
64}
65
66Status validate_arguments(const ITensorInfo *src, const ITensorInfo *dst, const ScaleKernelInfo &info)
67{

Callers 2

validate_argumentsFunction · 0.85
configureMethod · 0.85

Calls 1

dimensionMethod · 0.45

Tested by

no test coverage detected