o
    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 g dZdd Zejejd	d
Zede	ddddddejdejdejdededefddZede	ddddejdejdejdefddZede	ddd#dejdejd ef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)	jit_utilsregistration)_grid_sampler_affine_grid_generatorgeluc                 C   s   | dkrdS | dkrdS | S )Nbilinearlinearbicubiccubic )mode_sr   r   o/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/torch/onnx/symbolic_opset20.pyconvert_grid_sample_mode&   s   

r      )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      i | ]\}}||qS r   r   .0kr   r   r   r   
<dictcomp>9       z!_grid_sampler.<locals>.<dictcomp>c                 S   r   r   r   r   r   r   r   r    <   r!   
GridSample)align_corners_ir   padding_mode_s)FGRID_SAMPLE_INTERPOLATION_MODESitemsr   GRID_SAMPLE_PADDING_MODESopint)r   r   r   r   r   r   r   r$   r   r   r   r   /   s   
r   zaten::affine_grid_generatorthetasizec                 C   s   | j d||t|dS )N
AffineGrid)r#   )r)   r*   )r   r+   r,   r   r   r   r   r   I   s   r   z
aten::gelusnoneselfapproximatec                 C   s   | j d||dS )NGelu)approximate_s)r)   )r   r0   r1   r   r   r   r   Y   s   r   )r/   )__doc__	functoolstorch.nn.functionalnn
functionalr%   torchr   
torch.onnxr   torch.onnx._internalr   r   __all__r   partialonnx_symbolic_onnx_symbolic
parse_argsGraphContextValuer*   boolr   r   strr   r   r   r   r   <module>   sL   
$