a
    ¢º”hÔ
  ã                   @   s:   d Z ddlm  mZ ddlmZ G dd„ dƒZeƒ ZdS )zïGlobals 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                   @   s²   e Zd ZdZddœdd„Zedd„ ƒZejej	dœd	d„ƒZee
dœd
d„ƒZeje
dœdd„ƒZeedœdd„ƒZejedœdd„ƒZeedœdd„ƒZejedœdd„ƒZdS )Ú_InternalGlobalsz·Globals 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.
    N)Úreturnc                 C   s8   t j| _tjj| _d| _d| _tj	j
| _d| _d| _d S )NFT)r   ZONNX_DEFAULT_OPSETÚ_export_onnx_opset_versionÚ_C_onnxÚTrainingModeZEVALÚ_training_modeÚ_in_onnx_exportZexport_trainingZOperatorExportTypesZONNXZoperator_export_typeZonnx_shape_inferenceÚ_autograd_inlining©Úself© r   úA/var/www/auris/lib/python3.9/site-packages/torch/onnx/_globals.pyÚ__init__   s    
ÿz_InternalGlobals.__init__c                 C   s   | j S )z#The training mode for the exporter.)r   r   r   r   r   Útraining_mode$   s    z_InternalGlobals.training_mode)r   c                 C   s   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   r   r   r   r   )   s
    ÿc                 C   s   | j S )z!Opset version used during export.©r   r   r   r   r   Úexport_onnx_opset_version2   s    z*_InternalGlobals.export_onnx_opset_version)Úvaluec                 C   s
   || _ d S )Nr   ©r   r   r   r   r   r   7   s    c                 C   s   | j S )z+Whether it is in the middle of ONNX export.)r	   r   r   r   r   Úin_onnx_export;   s    z_InternalGlobals.in_onnx_exportc                 C   s   t |ƒturtdƒ‚|| _d S )Nz in_onnx_export must be a boolean)ÚtypeÚboolr   r	   r   r   r   r   r   @   s    c                 C   s   | j S )z!Whether Autograd must be inlined.)r
   r   r   r   r   Úautograd_inliningF   s    z"_InternalGlobals.autograd_inliningc                 C   s   t |ƒturtdƒ‚|| _d S )Nz#autograd_inlining must be a boolean)r   r   r   r
   r   r   r   r   r   K   s    )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úpropertyr   Úsetterr   r   Úintr   r   r   r   r   r   r   r   r      s$   
r   )	r   Ztorch._C._onnxZ_CZ_onnxr   Z
torch.onnxr   r   ZGLOBALSr   r   r   r   Ú<module>   s   A