ONNX export failed on an operator with unrecognized namespace torchvision::nms. If you are trying to export a custom operator, make sure you registered it with the right domain and version

I am getting this error while exporting the model to onnx. I have tried to fiddle around with operator_export_type in ONNX, but its not solving the issue. I have also tried different versions such as opset_version = 10, opset_version = 11, but I am getting the same error.

Could someone help me with this? Anything I could try?