Hi,
This function appears to be written to be used only at test time (not training). And you appear to call it will a Tensor that requires_grad=True. If this is in your test code, you should set with torch.no_grad(): around your network to specify that you don’t need gradients. If this is training code, then I’m afraid you’ll have to modify the nms function to use only operations that support the autograd.