o
    wÖiº  ã                   @  sF   d dl mZ d dlZd dlm  mZ 	ddd	d
„Z	dddd„ZdS )é    )ÚannotationsNFÚmodelúonnx.ModelProtoÚconvert_versionÚboolÚreturnc                 C  s&   t  |  ¡ |¡}t ¡ }| |¡ |S )ab  Inline model-local functions in given model.

    Arguments:
        model: an ONNX ModelProto
        convert_version: if true, try to apply automatic version-conversion to functions requiring a
            different (ONNX) opset version from the model.

    Returns:
        ModelProto with all calls to model-local functions inlined (recursively)
    )ÚCÚinline_local_functionsÚSerializeToStringÚonnxÚ
ModelProtoÚParseFromString)r   r   ÚresultÚinlined_model© r   úI/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/onnx/inliner.pyr	      s   
r	   Úfunction_idsúlist[tuple[str, str]]Úexcludec                 C  s(   t  |  ¡ ||¡}t ¡ }| |¡ |S )aü  Inline selected model-local functions in given model.

    Arguments:
        model: an ONNX ModelProto
        function_ids: list of functions to include/exclude when inlining. Each
            element is a tuple of (function domain, function name).
        exclude: if true, inlines all functions except those specified in function_ids.
           if false, inlines all functions specified in function_ids.

    Returns:
        ModelProto with all calls to model-local functions inlined (recursively)
    )r   Úinline_selected_functionsr
   r   r   r   )r   r   r   r   r   r   r   r   r      s   
ÿ
r   )F)r   r   r   r   r   r   )r   r   r   r   r   r   r   r   )	Ú
__future__r   r   Úonnx.onnx_cpp2py_export.inlinerÚonnx_cpp2py_exportÚinlinerr   r	   r   r   r   r   r   Ú<module>   s   ÿÿ