Skip to content

Version Converter fails to convert a model with local functions  #4370

@liqunfu

Description

@liqunfu

Feature Request

System information

ONNX version (you are using): 1.12.0

What is the problem that this feature solves?

Please detail the discrepancy with our current functionality.
Local function has been added to ONNX in release 1.10.0. Version converted does support local functions. If a model contains local functions, output of version converter is not a valid model. See below a repo to the problem.

Describe the alternatives you have considered

A clear and concise description of any alternative solutions or features you've considered
To update version converter to support local functions

Describe the feature

Why is this feature necessary? What does it accomplish?
Version converter can be used to convert models with local functions

Will this influence the current api?

If yes, how? No

Feature Area

Which area in ONNX does this impact? (e.g. model usage, backend, best practices, converters, shape_inference, version_converter, training, test, operators): version_converter

Are you willing to contribute it (Y/N):

Notes

Any additional information

running this script. It shows that model_converted no longer has function body for the Square custom op. The model is invalid and cannot be run with ORT.

    input = '''
        <
        ir_version: 9,
        opset_import: [ "" : 15, "custom_domain" : 1],
        producer_name: "FunctionProtoTest",
        producer_version: "1.0",
        model_version: 1,
        doc_string: "A test model for model local functions."
      >
     agraph (float[N] x) => (float[N] out)
     {
        out = custom_domain.Square(x)
     }

     <
     domain: "custom_domain",
     opset_import: [ "" : 15],
     doc_string: "Test function proto"
     >
       Square
       (X) => (C)
       {
           C = Mul(X, X)
       }
     '''

    model = onnx.parser.parse_model(input)
    print(model)
    model_converted = onnx.version_converter.convert_version(model=model, target_version=16)
    print(model_converted)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions