Skip to content

Commit

Permalink
[ONNX] Use take instead of min in NMS conditions (apache#7633)
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi authored and trevor-m committed May 11, 2021
1 parent 8f36bfa commit 1b3d00b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/tvm/relay/frontend/onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2453,7 +2453,7 @@ def _first_cond(
nms_size_out,
):
# Loop over classes, end when i == C
return _op.min(_op.less(i, C))
return _op.take(_op.less(i, C), _expr.const(0))

def _first_body(
i,
Expand Down Expand Up @@ -2561,7 +2561,7 @@ def _first_body(

def _inner_cond(i, j, C, onnx_out, nms_size, out):
# inner loop over number of classes
return _op.min(_op.less(j, C))
return _op.take(_op.less(j, C), _expr.const(0))

def _inner_body(i, j, C, onnx_out, nms_size, out):
# slice to get current batch and class for valid box indicator
Expand Down Expand Up @@ -2591,7 +2591,7 @@ def _inner_body(i, j, C, onnx_out, nms_size, out):

def _outer_cond(i, B, C, onnx_out, nms_size_out, out):
# Outer loop is over batch size
return _op.min(_op.less(i, B))
return _op.take(_op.less(i, B), _expr.const(0))

def _outer_body(i, B, C, onnx_out, nms_size_out, out):
# Outer loop just calls inner loop
Expand Down

0 comments on commit 1b3d00b

Please sign in to comment.