YOLO7 indices should be either on cpu or on the same device as the indexed tensor (cpu)
在loss.py文件解决办法:在loss.py文件中增加下图中第一行,修改下面二三行device=targets.devicefrom_which_layer.append((torch.ones(size=(len(b),))*i).to(torch.device(device)))fg_mask_inboxes=fg_mask_inboxes.to(torch.device(device))