NotImplementedError: Could not run 'torchvision::nms' with arguments from the 'CUDA' backend.
时间: 2023-11-27 08:06:33 浏览: 222
Pytorch安装问题:pip3 install torchvision报错解决
5星 · 资源好评率100%
This error occurs when the code is trying to run the non-maximum suppression (NMS) function from the torchvision module using the CUDA backend, but the implementation of the function for CUDA is not available.
To resolve this issue, you can either switch to using the CPU backend by setting the device to "cpu" before calling the NMS function:
```
import torch
# ...
# Set device to CPU
device = torch.device("cpu")
# Call NMS function
boxes = torchvision.ops.nms(boxes, scores, iou_threshold)
```
Alternatively, you can check that your system has the appropriate version of PyTorch and torchvision installed with CUDA support. You can also try updating your PyTorch and torchvision packages to the latest version that supports CUDA.
阅读全文