Register onnx op failed

I’m registering custom ops from TorchScript to ONNX refer to, But I met the following error:

Traceback (most recent call last):
  File "", line 23, in <module>
  File "/home/dai/py36env/lib/python3.6/site-packages/torch/", line 61, in __getattr__
    op = torch._C._jit_get_operation(qualified_op_name)
RuntimeError: No such operator custom_ops::intersection

Here is my code:


def intersection(g,p):
    return torch.ops.my_ops.iou(g[:8],p[:8])

register_custom_op_symbolic('custom_ops::intersection', intersection, 11)
# register_custom_op_symbolic('custom_ops::intersection', torch.ops.my_ops.iou, 11)
print(torch.ops.custom_ops.intersection) is the custom op file of TorchScript defined in C++. How can I convert it to ONNX op?