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

Function __refelection

python/tvm/topi/testing/grid_sample_python.py:73–85  ·  view source on GitHub ↗
(i, size, corner_start)

Source from the content-addressed store, hash-verified

71
72 def _reflect_coordinates(i, size):
73 def __refelection(i, size, corner_start):
74 def __reflect(index, size, corner_start):
75 index_align_corner = abs(corner_start - index)
76 size_times = index_align_corner // size
77 even = size_times % 2 == 0
78 extra = index_align_corner - size_times * size
79 return extra + corner_start if even else size - extra + corner_start
80
81 if corner_start <= i <= size + corner_start:
82 new_i = i
83 else:
84 new_i = __reflect(i, size, corner_start)
85 return new_i
86
87 if align_corners:
88 x = __refelection(i, size - 1, 0)

Callers 1

_reflect_coordinatesFunction · 0.70

Calls 1

__reflectFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…