Skip to content

Commit

Permalink
slight change to initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi committed Dec 28, 2020
1 parent 9b42008 commit 3a27397
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions python/tvm/topi/cuda/nms.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,6 @@ def calculate_overlap(out_tensor, box_a_idx, box_b_idx):
tvm.tir.all(top_k > 0, top_k < valid_count[i]), top_k, valid_count[i]
)
j = bx * max_threads + tx
with ib.if_scope(j < num_anchors):
box_indices[i * num_anchors + j] = -1
with ib.if_scope(j < nkeep):
# Fill in out with sorted boxes
with ib.for_range(0, box_data_length) as k:
Expand All @@ -500,9 +498,16 @@ def calculate_overlap(out_tensor, box_a_idx, box_b_idx):
]
with ib.else_scope():
# Indices > nkeep are discarded
# Only needed for return_indices = False case
if return_indices is False:
with ib.if_scope(j < num_anchors):
with ib.for_range(0, box_data_length) as k:
out[(base_idx + j * box_data_length + k)] = -1.0

if return_indices:
with ib.if_scope(j < num_anchors):
with ib.for_range(0, box_data_length) as k:
out[(base_idx + j * box_data_length + k)] = -1.0
box_indices[i * num_anchors + j] = -1

with ib.else_scope():
with ib.if_scope(j < valid_count[i]):
with ib.for_range(0, box_data_length) as k:
Expand Down

0 comments on commit 3a27397

Please sign in to comment.