torch.where

box_target = torch.where(
cls_target[..., None] == -1, box_target.new_tensor(0), box_target
)

cls_target[b,23] cls_target[..., None] [b,23,1]
box_target[b,23,10]

posted @ 2026-07-20 21:18  无左无右  阅读(3)  评论(0)    收藏  举报