
    Χg                     V    d Z ddlmc mZ ddlmZ  G d d          Z e            ZdS )zGlobals used internally by the ONNX exporter.

Do not use this module outside of `torch.onnx` and its tests.

Be very judicious when adding any new global variables. Do not create new global
variables unless they are absolutely necessary.
    N)
_constantsc                   &   e Zd ZdZddZed             Zej        dej	        fd            Zede
fd            Zej        d	e
fd
            Zedefd            Zej        d	efd            Zedefd            Zej        d	efd            ZdS )_InternalGlobalszGlobals used internally by ONNX exporter.

    NOTE: Be very judicious when adding any new variables. Do not create new
    global variables unless they are absolutely necessary.
    returnNc                     t           j        | _        t          j        j        | _        d| _        d| _        t          j	        j
        | _        d| _        d| _        d S )NFT)r   ONNX_DEFAULT_OPSET_export_onnx_opset_version_C_onnxTrainingModeEVAL_training_mode_in_onnx_exportexport_trainingOperatorExportTypesONNXoperator_export_typeonnx_shape_inference_autograd_inliningselfs    O/var/www/html/ai-engine/env/lib/python3.11/site-packages/torch/onnx/_globals.py__init__z_InternalGlobals.__init__   sT    *4*G'4;4H4M%*%*', 	! +/!(,    c                     | j         S )z#The training mode for the exporter.)r   r   s    r   training_modez_InternalGlobals.training_mode$   s     ""r   r   c                 f    t          |t          j                  st          d          || _        d S )Nz\training_mode must be of type 'torch.onnx.TrainingMode'. This is likely a bug in torch.onnx.)
isinstancer
   r   	TypeErrorr   )r   r   s     r   r   z_InternalGlobals.training_mode)   s>    -)=>> 	.   ,r   c                     | j         S )z!Opset version used during export.)r	   r   s    r   export_onnx_opset_versionz*_InternalGlobals.export_onnx_opset_version2   s     ..r   valuec                     t          t          j        t          j        dz             }||vrt	          d|           || _        d S )N   z Unsupported ONNX opset version: )ranger   ONNX_MIN_OPSETONNX_MAX_OPSET
ValueErrorr	   )r   r!   supported_versionss      r   r    z*_InternalGlobals.export_onnx_opset_version7   sU    "%z'@1'D
 
 ***GGGHHH*/'''r   c                     | j         S )z+Whether it is in the middle of ONNX export.)r   r   s    r   in_onnx_exportz_InternalGlobals.in_onnx_export@   s     ##r   c                 ^    t          |          t          urt          d          || _        d S )Nz in_onnx_export must be a boolean)typeboolr   r   r   r!   s     r   r*   z_InternalGlobals.in_onnx_exportE   s0    ;;d"">???$r   c                     | j         S )z!Whether Autograd must be inlined.)r   r   s    r   autograd_inliningz"_InternalGlobals.autograd_inliningK   s     &&r   c                 ^    t          |          t          urt          d          || _        d S )Nz#autograd_inlining must be a boolean)r,   r-   r   r   r.   s     r   r0   z"_InternalGlobals.autograd_inliningP   s0    ;;d""ABBB"'r   )r   N)__name__
__module____qualname____doc__r   propertyr   setterr
   r   intr    r-   r*   r0    r   r   r   r      sq        
- 
- 
- 
- # # X# ,7+? , , , , /3 / / / X/ %0s 0 0 0 &%0 $ $ $ $ X$ %D % % % %
 '4 ' ' ' X' (t ( ( ( ( ( (r   r   )	r5   torch._C._onnx_C_onnxr
   
torch.onnxr   r   GLOBALSr9   r   r   <module>r?      s     !                 " ! ! ! ! !C( C( C( C( C( C( C( C(L 


r   