-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Closed
Copy link
Labels
Description
Bug Report
Describe the bug
SegFault during shape inference if the schema not be set inference function
Reproduction instructions
cpp (Optional):
ONNX_OPERATOR_SCHEMA(CustomOp);
python:
import onnx
from onnx import defs
input = """
<
ir_version: 7,
opset_import: [
"" : 1
]
>
agraph (float[N, 128] X, int32 Y) => (float[N] Z)
{
Z = CustomOp(X, Y)
}
"""
model = onnx.parser.parse_model(input)
op_schema = defs.OpSchema(
'CustomOp',
'',
1,
inputs=[
],
outputs=[
],
)
# Uncomment if not register in cpp
# onnx.defs.register_schema(op_schema)
onnx.shape_inference.infer_shapes(model, True)
Expected behavior
Raise a python exception rather than crash.
Notes
The root case is the input or output of schema is empty and the corresponding field in graph is no-empty. So the input.back
from schema will invalid.