Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Crash] Use @onnx_op to parse a custom operator for the model, and program crashed in inference #867

Open
Liuhehe2019 opened this issue Dec 24, 2024 · 0 comments

Comments

@Liuhehe2019
Copy link

This is my custom operator definition:

@onnx_op(op_type='LocatePostNms',
domain='ai.onnx.contrib',
inputs=[PyCustomOpDef.dt_float, PyCustomOpDef.dt_int32, PyCustomOpDef.dt_float, PyCustomOpDef.dt_float,
PyCustomOpDef.dt_int32, PyCustomOpDef.dt_float],
outputs=[PyCustomOpDef.dt_float, PyCustomOpDef.dt_int32],
attrs={"classNumber": PyCustomOpDef.dt_int32,
"iou_thresh": PyCustomOpDef.dt_float,
"scale": PyCustomOpDef.dt_double,
"side": PyCustomOpDef.dt_int32,
"topk": PyCustomOpDef.dt_int32,
"type": PyCustomOpDef.dt_int32}
)
def locatepostnms_compute(p0, l0, b0, p1, l1, b1, **kwargs):
classNumber = kwargs['classNumber']
iou_thresh = kwargs['iou_thresh']
scale = kwargs['scale']
side = kwargs['side']
topk = kwargs['topk']
type = kwargs['type']
padded_box, result_cnt = cvt_compute(x)
return padded_box, result_cnt

I just using:
sess_options = rt.SessionOptions()
sess_options.register_custom_ops_library(onnxruntime_extensions.get_library_path())
to register the custom operator, and it works

but when comes to
rt.InferenceSession().run()

the program crashed and reported: Process finished with exit code -1073740791 (0xC0000409)

I have no idea with this issue, could you give me some suggesstion about that?

By the way, how to quantize this model with custom op in onnxruntime python?
onnxruntime. quantization. quantize. quantize_static report error:
onnx.onnx_cpp2py_export.shape_inference.InferenceError: [TypeInferenceError] Cannot infer type and shape for node name 453. No opset import for domain ai.onnx.contrib optype LocatePostNms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant