hsuanguo commented on a change in pull request #7188:
URL: https://github.com/apache/tvm/pull/7188#discussion_r559240283
##########
File path: python/tvm/topi/cuda/ssd/multibox.py
##########
@@ -341,47 +341,25 @@ 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(tid == 0):
- out_base_idx = i * num_anchors * 6
- out_loc[out_base_idx] = cls_id[tid] - 1.0
- out_loc[out_base_idx + 1] = score[tid]
- (
- out_loc[out_base_idx + 2],
- out_loc[out_base_idx + 3],
- out_loc[out_base_idx + 4],
- out_loc[out_base_idx + 5],
- ) = transform_loc(
- loc_pred,
- tid * 4,
- anchor,
- j * 4,
- clip,
- variances[0],
- variances[1],
- variances[2],
- variances[3],
- )
- with ib.else_scope():
- out_base_idx = i * num_anchors * 6 + temp_valid_count[tid - 1]
* 6
- out_loc[out_base_idx] = cls_id[tid] - 1.0
- out_loc[out_base_idx + 1] = score[tid]
- (
- out_loc[out_base_idx + 2],
- out_loc[out_base_idx + 3],
- out_loc[out_base_idx + 4],
- out_loc[out_base_idx + 5],
- ) = transform_loc(
- loc_pred,
- tid * 4,
- anchor,
- j * 4,
- clip,
- variances[0],
- variances[1],
- variances[2],
- variances[3],
- )
+ out_base_idx = i * num_anchors * 6 + tid * 6
Review comment:
> To be consistent with the CPU implementation:
>
>
https://github.com/apache/tvm/blob/e561007f0c330e3d14c2bc8a3ef40fb741db9004/python/tvm/topi/vision/ssd/multibox.py#L229
>
>
> When `cls_id` is not larger than 0, we don't put its value in `out_loc`,
could you elaborate on how did you deal with that case?
The implementation is not exact the same as the CPU version, the order of
the output will not be the same as the CPU version, but the boxes would be,
regarding removing the background that was my mistake, I missed it.
I think it might be better to close this PR and come with a better solution,
or keep the initialization part if it makes sense to you(revert to the initial
title)? @Laurawly what do you think? In any case I think the op needs some
rework to be more robust.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]