Aleksei-grovety commented on code in PR #15117:
URL: https://github.com/apache/tvm/pull/15117#discussion_r1246658466
##########
python/tvm/topi/cuda/ssd/multibox.py:
##########
@@ -341,10 +360,12 @@ def transform_loc(loc, loc_base_idx, anchor,
anchor_base_idx, clip, vx, vy, vw,
i = idxd(tid, num_anchors)
j = idxm(tid, num_anchors)
- with ib.if_scope(cls_id[tid] > 0):
+ with ib.if_scope(tvm.tir.any(keep_background == 1, cls_id[tid] > 0)):
with ib.if_scope(j == 0):
out_base_idx = i * num_anchors * 6
- out_loc[out_base_idx] = cls_id[tid] - 1.0
+ out_loc[out_base_idx] = (
+ cls_id[tid] - 0.0 if keep_background == 1 else cls_id[tid]
- 1.0
Review Comment:
Is it necessary to subtract zero here?
##########
python/tvm/relay/op/vision/_vision.py:
##########
@@ -122,6 +125,33 @@ def all_class_nms_shape_func(attrs, inputs, _):
return _all_class_nms_shape_func_tf(inputs[0], inputs[1])
+@script
+def _regular_nms_shape_func(boxes_shape, scores_shape, attrs):
+ out_boxes_shape = output_tensor((3,), "int64")
+ out_classes_shape = output_tensor((2,), "int64")
+ out_scores_shape = output_tensor((2,), "int64")
+ out_num_detections_shape = output_tensor((1,), "int64")
+
+ out_boxes_shape[0] = boxes_shape[0]
+ out_boxes_shape[1] = int64(attrs.max_detections)
+ out_boxes_shape[2] = int64(4)
+
+ out_classes_shape[0] = boxes_shape[0]
+ out_classes_shape[1] = int64(attrs.max_detections)
+
+ out_scores_shape[0] = boxes_shape[0]
+ out_scores_shape[1] = int64(attrs.max_detections)
+
+ out_num_detections_shape[0] = int64(1)
Review Comment:
Shouldn't there be `out_num_detections_shape[0] = boxes_shape[0]`? As
further comments point to `num_detections` of size `(batch_size,)`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]