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

Function bilinear_policy

tests/validation/reference/Utils.cpp:36–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34// Return the bilinear value at a specified coordinate with different border modes
35template <typename T>
36T bilinear_policy(
37 const SimpleTensor<T> &in, Coordinates id, float xn, float yn, BorderMode border_mode, T constant_border_value)
38{
39 const int idx = std::floor(xn);
40 const int idy = std::floor(yn);
41
42 const float dx = xn - idx;
43 const float dy = yn - idy;
44 const float dx_1 = 1.0f - dx;
45 const float dy_1 = 1.0f - dy;
46
47 const T border_value = constant_border_value;
48
49 id.set(0, idx);
50 id.set(1, idy);
51 const float tl = tensor_elem_at(in, id, border_mode, border_value);
52 id.set(0, idx + 1);
53 id.set(1, idy);
54 const float tr = tensor_elem_at(in, id, border_mode, border_value);
55 id.set(0, idx);
56 id.set(1, idy + 1);
57 const float bl = tensor_elem_at(in, id, border_mode, border_value);
58 id.set(0, idx + 1);
59 id.set(1, idy + 1);
60 const float br = tensor_elem_at(in, id, border_mode, border_value);
61
62 return static_cast<T>(tl * (dx_1 * dy_1) + tr * (dx * dy_1) + bl * (dx_1 * dy) + br * (dx * dy));
63}
64
65template int8_t bilinear_policy(const SimpleTensor<int8_t> &in,
66 Coordinates id,

Callers 1

scale_coreFunction · 0.85

Calls 3

floorFunction · 0.85
tensor_elem_atFunction · 0.85
setMethod · 0.45

Tested by

no test coverage detected