Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix flaky TF test
Browse files Browse the repository at this point in the history
Matthew committed Jul 9, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 683c5eb commit c1c2b0a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions python/tvm/topi/image/resize.py
Original file line number Diff line number Diff line change
@@ -77,8 +77,7 @@ def get_3d_indices(indices, layout="NCDHW"):

def get_1d_pixel(data, layout, boxes, image_width, n, c, x, cc, ib, ic):
"""Get 1d pixel"""
if boxes is None:
x = tvm.te.max(tvm.te.min(x, image_width - 1), 0)
x = tvm.te.max(tvm.te.min(x, image_width - 1), 0)
if layout == "NWC":
return data(n, x, c).astype("float")
if layout == "NCW":
@@ -93,9 +92,8 @@ def get_1d_pixel(data, layout, boxes, image_width, n, c, x, cc, ib, ic):

def get_2d_pixel(data, layout, boxes, image_height, image_width, n, c, y, x, cc, ib, ic):
"""Get 2d pixel"""
if boxes is None:
y = tvm.te.max(tvm.te.min(y, image_height - 1), 0)
x = tvm.te.max(tvm.te.min(x, image_width - 1), 0)
y = tvm.te.max(tvm.te.min(y, image_height - 1), 0)
x = tvm.te.max(tvm.te.min(x, image_width - 1), 0)
if layout == "NHWC":
return data(n, y, x, c).astype("float")
if layout == "NCHW":

0 comments on commit c1c2b0a

Please sign in to comment.