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

Function _triilinear_sample

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

Source from the content-addressed store, hash-verified

325 out[_b, _c, _d, _h, _w] = _get_pixel(_b, _c, new_z, new_y, new_x)
326
327 def _triilinear_sample():
328 for _b in range(batch):
329 for _c in range(channel):
330 for _d in range(out_depth):
331 for _h in range(out_height):
332 for _w in range(out_width):
333 z, y, x = _compute_source_index(_b, _d, _h, _w)
334 z0 = math.floor(z)
335 y0 = math.floor(y)
336 x0 = math.floor(x)
337 z1 = z0 + 1
338 y1 = y0 + 1
339 x1 = x0 + 1
340
341 out[_b, _c, _d, _h, _w] = (
342 _get_pixel(_b, _c, z0, y0, x0)
343 * (1 - (x - x0))
344 * (1 - (y - y0))
345 * (1 - (z - z0))
346 + _get_pixel(_b, _c, z0, y0, x1)
347 * (x - x0)
348 * (1 - (y - y0))
349 * (1 - (z - z0))
350 + _get_pixel(_b, _c, z1, y1, x0)
351 * (1 - (x - x0))
352 * (y - y0)
353 * (z - z0)
354 + _get_pixel(_b, _c, z1, y1, x1) * (x - x0) * (y - y0) * (z - z0)
355 + _get_pixel(_b, _c, z0, y1, x0)
356 * (1 - (x - x0))
357 * (y - y0)
358 * (1 - (z - z0))
359 + _get_pixel(_b, _c, z1, y0, x1)
360 * (x - x0)
361 * (1 - (y - y0))
362 * (z - z0)
363 + _get_pixel(_b, _c, z1, y0, x0)
364 * (1 - (x - x0))
365 * (1 - (y - y0))
366 * (z - z0)
367 + _get_pixel(_b, _c, z0, y1, x1)
368 * (x - x0)
369 * (y - y0)
370 * (1 - (z - z0))
371 )
372
373 if method == "bilinear":
374 _triilinear_sample()

Callers 1

grid_sample_3dFunction · 0.85

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…