MCPcopy Create free account
hub / github.com/apache/tvm / _nearest_sample

Function _nearest_sample

python/tvm/topi/testing/grid_sample_python.py:109–119  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107 return (y, x)
108
109 def _nearest_sample():
110 for _b in range(batch):
111 for _c in range(channel):
112 for _h in range(out_height):
113 for _w in range(out_width):
114 y, x = _compute_source_index(_b, _h, _w)
115 # python round is not used here,
116 # beacause it is done toward the even choice
117 new_y = int(y + 0.5) if y > 0 else int(y - 0.5)
118 new_x = int(x + 0.5) if x > 0 else int(x - 0.5)
119 out[_b, _c, _h, _w] = _get_pixel(_b, _c, new_y, new_x)
120
121 def _bilinear_sample():
122 for _b in range(batch):

Callers 2

grid_sample_2dFunction · 0.70
grid_sample_3dFunction · 0.70

Calls 2

_compute_source_indexFunction · 0.70
_get_pixelFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…