torch_npu.npu_ciou(Tensor self, Tensor gtboxes, bool trans=False, bool is_cross=True, int mode=0, bool atan_sub_flag=False) -> Tensor
应用基于NPU的CIoU操作。在DIoU的基础上增加了penalty item,并propose CIoU。
torch.Tensor:mask操作的结果。
到目前为止,CIoU向后只支持当前版本中的trans==True、is_cross==False、mode==0('iou')。如果需要反向传播,确保参数正确。
1 2 3 4 5 6 7 | >>> box1 = torch.randn(4, 32).npu() >>> box1.requires_grad = True >>> box2 = torch.randn(4, 32).npu() >>> box2.requires_grad = True >>> ciou = torch_npu.npu_ciou(box1, box2, trans=True, is_cross=False, mode=0) >>> l = ciou.sum() >>> l.backward() |