o
    so™i:  ã                   @  sH   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   ú@/home/ubuntu/.local/lib/python3.10/site-packages/onnx/inliner.pyr	      s   
r	   Úfunction_idsúlist[tuple[str, str]]ÚexcludeÚinline_schema_functionsc                 C  s@   |rt  |  ¡ ||¡}n	t  |  ¡ ||¡}t ¡ }| |¡ |S )aœ  Inline selected 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.
        inline_schema_functions: if true, inlines schema-defined functions as well
            as model-local functions. Otherwise, only model-local functions are inlined.

    Returns:
        ModelProto with all calls to model-local functions inlined (recursively)
    )r   Úinline_selected_functions2r
   Úinline_selected_functionsr   r   r   )r   r   r   r   r   r   r   r   r   r      s   
ÿ
ÿ
r   )F)r   r   r   r   r   r   )FF)
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   ÿü