mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-19 21:32:23 +00:00
Fix contrib ops unregister to match pytorch behavior (#5052)
This commit is contained in:
parent
d7502eff8f
commit
73456f10cd
1 changed files with 6 additions and 2 deletions
|
|
@ -43,10 +43,14 @@ def unregister_custom_op():
|
|||
|
||||
import torch.onnx.symbolic_registry as sym_registry
|
||||
|
||||
# TODO: replace this once PyTorch supports unregister natively.
|
||||
def unregister(name, opset_version):
|
||||
ns, kind = name.split("::")
|
||||
if sym_registry.is_registered_op(kind, ns, opset_version):
|
||||
del sym_registry._registry[(ns, opset_version)][kind]
|
||||
from torch.onnx.symbolic_helper import _onnx_stable_opsets
|
||||
|
||||
for version in _onnx_stable_opsets:
|
||||
if version >= opset_version and sym_registry.is_registered_op(kind, ns, version):
|
||||
del sym_registry._registry[(ns, version)][kind]
|
||||
|
||||
unregister('::inverse', _onnx_opset_version)
|
||||
unregister('::gelu', _onnx_opset_version)
|
||||
|
|
|
|||
Loading…
Reference in a new issue