Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ONNX] Use take instead of min in NMS conditions #7633

Merged
merged 1 commit into from
Mar 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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