U
    8‹ÑhÅ  ã                
   @   sâ   d Z ddlZddlm  mZ ddlmZ ddlm	Z	 ddl
mZmZmZ ddgZdd	„ Zejejd
d�Zedƒe	 ddddd¡ejejejejeeedœdd„ƒƒƒZedƒe	 ddd¡ejejejejedœdd„ƒƒƒZdS )aÉ  This file exports ONNX ops for opset 20.

Note [ONNX Operators that are added/updated in opset 20]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
https://github.com/onnx/onnx/blob/main/docs/Changelog.md#version-20-of-the-default-onnx-operator-set
New operators:
    AffineGrid
    ConstantOfShape
    DFT
    Gelu
    GridSample
    ImageDecoder
    IsInf
    IsNaN
    ReduceMax
    ReduceMin
    RegexFullMatch
    StringConcat
    StringSplit
é    N)Ú_C)Úsymbolic_helper)Ú	_beartypeÚ	jit_utilsÚregistrationÚ_grid_samplerÚ_affine_grid_generatorc                 C   s   | dkrdS | dkrdS | S )NZbilinearZlinearZbicubicZcubic© )Úmode_sr	   r	   úI/tmp/user/2202/pip-unpacked-wheel-bf9o3bgk/torch/onnx/symbolic_opset20.pyÚconvert_grid_sample_mode&   s    ÿr   é   )Zopsetzaten::grid_samplerÚvÚiÚb)ÚgÚinputÚgridÚ	mode_enumÚpadding_mode_enumÚalign_cornersc                 C   sR   dd„ t j ¡ D ƒ| }t|ƒ}dd„ t j ¡ D ƒ| }| jd||t|ƒ||d�S )Nc                 S   s   i | ]\}}||“qS r	   r	   ©Ú.0Úkr   r	   r	   r   Ú
<dictcomp>:   s      z!_grid_sampler.<locals>.<dictcomp>c                 S   s   i | ]\}}||“qS r	   r	   r   r	   r	   r   r   =   s      Z
GridSample)Úalign_corners_ir
   Úpadding_mode_s)ÚFZGRID_SAMPLE_INTERPOLATION_MODESÚitemsr   ZGRID_SAMPLE_PADDING_MODESÚopÚint)r   r   r   r   r   r   r
   r   r	   r	   r   r   /   s    úzaten::affine_grid_generator©r   ÚthetaÚsizer   c                 C   s   | j d||t|ƒd�S )NZ
AffineGrid)r   )r   r    r!   r	   r	   r   r   H   s    	ü)Ú__doc__Ú	functoolsZtorch.nn.functionalÚnnZ
functionalr   Ztorchr   Z
torch.onnxr   Ztorch.onnx._internalr   r   r   Ú__all__r   ÚpartialZonnx_symbolicZ_onnx_symbolicÚ
parse_argsZbeartypeZGraphContextÚValuer    Úboolr   r   r	   r	   r	   r   Ú<module>   s4   úü