补齐---F.pad, torch.stack

     #[2,23]
     cls_target = torch.stack(
            [
                F.pad(x, (0, max_dn_gt - x.shape[0]), value=-1)
                for x in cls_target
            ] #cls_target[0]23    cls_target[1]20   max_dn_gt23

         #[b,23,10]
        box_target = torch.stack(
            [F.pad(x, (0, 0, 0, max_dn_gt - x.shape[0])) for x in box_target]
        ) #[b,23,10]   box_target[0] [23,10]   box_target[1] [20,10]
posted @ 2026-07-24 15:09  无左无右  阅读(5)  评论(0)    收藏  举报