
    ֧g(                         d dl Z d dlZd dlZd dlmZ d Zd Zd Zd Z	d Z
d Zdd
Zd Zd Zd Zd Zd Zd Zd Zd Z e            ZdS )    N)_find_builtinc                 X    |                      d          o|                      d           S )N___)
startswith)names    S/var/www/html/ai-engine/env/lib/python3.11/site-packages/torch/jit/supported_ops.py_hiddenr
      s(    ??3=(=(=$==    c                      t          |           S N)str)types    r	   
_emit_typer      s    t99r   c                     |j          dt          |j                   }|j        }|| dt	          |           }|dk    r
dd| z   | }|S )Nz : =r   
 )r   r   r   default_valuer   )indentiargvdefaults        r	   	_emit_argr      sl    8..
38,,..AG!!3w<<!!1uu"v"q""Hr   c                 `     d                      fdt          |          D                       S )N,c              3   @   K   | ]\  }}t          ||          V  d S r   )r   ).0r   r   r   s      r	   	<genexpr>z_emit_args.<locals>.<genexpr>!   s3      QQ&!SIfa--QQQQQQr   )join	enumerate)r   	argumentss   ` r	   
_emit_argsr$       s2    88QQQQIi<P<PQQQQQQr   c                 *    t          | j                  S r   )r   r   )rets    r	   	_emit_retr'   $   s    chr   c                     t          |           dk    rt          | d                   S dd                    d | D                        dS )N   r   zTuple[z, c              3   4   K   | ]}t          |          V  d S r   )r'   )r   rs     r	   r    z_emit_rets.<locals>.<genexpr>+   s(      <<qill<<<<<<r   ])lenr'   r!   )returnss    r	   
_emit_retsr/   (   sQ    
7||q$$$?DII<<G<<<<<????r      c                     | |}n|  d| }| dt          t          |          dz   |z   |j        |d                     dt          |j                   }|S )N.(r)   z) -> )r$   r-   r#   r/   r.   )modr   schema	arg_startpaddingqualified_name
schema_strs          r	   _emit_schemar:   .   s    
{$ 	+ 	+s>**Q.8&:J9:::VWW	+ 	+((	+ 	+ 
 r   c            
         d } g }t          t          j                  D ]i}t          |          sXt          j                            d|z             }|D ]3} | |          r&|                    t          d||d                     4jd|fS )Nc                     t          | j                  dk    rdS | j        d         }|j        dk    rdS |j                            t
          j        j                                                  sdS dS )Nr   FselfT)	r-   r#   r   r   isSubtypeOftorch_C
TensorTypeget)r5   r=   s     r	   is_tensor_methodz)_get_tensor_ops.<locals>.is_tensor_method<   so    v  A%%5"95y$$UX%8%<%<%>%>?? 	5tr   aten::Tensorr)   )r6   zSupported Tensor Methods)dirr?   rE   r
   r@   _jit_get_schemas_for_operatorappendr:   )rC   methodselemschemasr5   s        r	   _get_tensor_opsrL   ;   s       GEL!! V Vt}} 	Vh<<X_MMG! V V##F++ VNN<$RS#T#T#TUUU%w..r   c            
      N   g } t           j        j        }|j        }t	          t           j        j                  D ]}t          ||          }t          j        |          rt          |d                   r<t          j	        |          }|st          d| d          d|j        vro	 t           j                            |          }|j        }|                     t          |||                     #  Y xY wt           j        j        j        D ]}|j        }t	          |          D ]x}t%          t          ||                    }|Wt           j                            |          }	|	D ]5}
t          |          s$|                     t          |||
                     6yd| fS )Nr   Module for 
 not foundztorch.nn.functionalzSupported PyTorch Functions)r?   nn
functional__name__rF   getattrinspect
isfunctionr
   	getmoduleRuntimeErrorjitscriptr5   rH   r:   	_builtins_modules_containing_builtinsr   r@   rG   )	functionsr4   r   rJ   attrattr_modulescriptedscripted_schemabuiltinrK   r5   s              r	   _get_nn_functional_opsrb   R   s   I (
C<DEH'((  sD!!!$'' 	747+;+; 	'-- 	?=T===>>> (<<<	y''--H&oO\$oFFGGGG	D y"? 	K 	K|HH 	K 	KD#GC$6$677G"(@@II% K KF"4== K!((dD&)I)IJJJ	K ))33s   )A
C44C8c                  N   g } t           j        j        j        D ]\  }}t	          j        |          }t          |d          s*|s-t          |j                  s(t          |j	                  st          |j                  rjd|j        v rt| 
                    ||f           | S )NrR   ztorch._C)r?   rX   rZ   _builtin_opsrT   rV   hasattrr
   rR   __qualname__rH   )builtinsfn_builtin_namer4   s       r	   _get_builtins_helperrj   }   s    H"Y0= - -M##r:&& 	 	2; 	72?#;#; 	ws|?T?T 	%%]+,,,,Or   c                 j    t          j        |           }|st          d|  d          |j        dk    S )NrN   rO   math)rT   rV   rW   rR   )rh   r4   s     r	   _is_math_fnrm      sA    

B

C 97777888<6!!r   c            	         g } t          d t                                }t          |          }|D ]\  }}t          j        |          }|st          d| d          t          |          }|Rt          j        	                    |          }|D ]0}| 
                    t          |j        |j        |                     1d| fS )Nc                 .    t          | d                    S Nr   rm   rh   s    r	   <lambda>z+_get_torchscript_builtins.<locals>.<lambda>   s    [A%7%7!7 r   rN   rO   zTorchScript Builtin Functions)filterrj   listrT   rV   rW   r   r?   r@   rG   rH   r:   rR   )	r\   rg   builtins_listrh   ri   r4   ra   rK   r5   s	            r	   _get_torchscript_builtinsrw      s    I779M9O9OPPHNNM* R RM## 	=;R;;;<<<##h<<WEEG! R R  clBK!P!PQQQQ*I55r   c                     g } t          d t                                }t          |          }|D ]\  }}t          j        |          }|st          d| d          t          |          }|Yt          j        	                    |          }|D ]7}t          |j        |j        |          }	d|	v r"|                     |           8d| fS )Nc                 ,    t          | d                   S rp   rq   rr   s    r	   rs   z$_get_math_builtins.<locals>.<lambda>   s    RU!3!3 r   rN   rO   rE   z``math`` Module)rt   rj   ru   rT   rV   rW   r   r?   r@   rG   r:   rR   rH   )
r\   rg   rv   rh   ri   r4   ra   rK   r5   r9   s
             r	   _get_math_builtinsrz      s    I335I5K5KLLHNNM* ) )M## 	=;R;;;<<<##h<<WEEG! ) ))#,VLL
z))   ((((i''r   c            
         g d} dddddddd	d
}ddddddddd}g d}g }|D ]!\  }}|                     d| d| d           "g }g }| D ]}d| }	||v r||         }	t          j                            |	          }
|
D ](}|                     t	          d ||d                     )t          |
          dk    r|                     d           d| d||          d}|                     |           d                    |          }d                    |          }d                    |          }t          j        |d          }t          j        |d          }t          j        |d          }d| d| d | d!}d"|fS )#N)printtuplefloatcomplexintboolr   rS   re   
isinstancer-   hexoctroundhashminmaxabsalldivmodru   ordchrbinrangezipr"   sortedz
aten::Boolz	aten::Intzaten::Floatzaten::Complexz	prim::absz	prim::maxz	prim::minzfake::does_not_exist)r   r   r~   r   r   r   r   r   zPrint any valuez]Lists cannot be converted to tuples with this method since their size is not statically knownz'Attribute name must be a literal stringzResult is staticzMArguments must be iterable. See :ref:`Iterables <jit_iterables>` for details.z-Can only be used as an iterator in a for loop)r|   r}   rS   re   r   r   r"   r   ))r   __complex__)r~   	__float__)r   __int__)r   __bool__)r   __str__)r-   __len__)r   __hex__)r   __oct__"z", "``z``"rD   r   )r7    z":external+python:py:obj:`z`", "r   	z
The functions in the following table are supported but do not have a static schema

.. csv-table::
    :header: "Function", "Note"

z

The following functions will use the corresponding magic method on :any:`TorchScript classes`

.. csv-table::
    :header: "Function", "Magic Method"

zX

These built-in functions use the schema

.. rst-class:: codeblock-height-limiter

::

z
    zPython Built-in Functions)	rH   r?   r@   rG   r:   r-   r!   textwrapr   )supported_builtins
op_renamesschemaless_op_explanationsmagic_methodsmagic_methods_rowsrh   magic_methodschematized_opsschemaless_opsop_namerK   s	table_rowschematized_ops_strschemaless_ops_strmagic_methods_rows_strsections                    r	   _get_global_builtinsr      s^     @ "'	 	J #p<<(^d@	" 	"	 	 	M ) C CL!!"Ab"A"A"A"A"ABBBBON  - -2-- nG(88AA 	I 	IA""<b!Q#G#G#GHHHHw<<!""2&&&& XRWW6PQS6TWWW  !!),,,,))O44>22!YY'9::"/*=tDD!);TBB%_-CTJJ    * +  G0 '//r   c                     d } d}t           t          t          t          t          f}|D ]} |            \  }}|                    dd                              dd                                                              dd          }t          |t                    r| ddt          |          z   d| d}n#| ddt          |          z   d | |           }d| d	d
z   |z   }||z  }|S )Nc                 f    d                     d                    d | D                                 S )Nz1
.. rst-class:: codeblock-height-limiter

::

{}
r   c              3   "   K   | ]
}d | dV  dS )z    

N )r   ds     r	   r    z:_list_supported_ops.<locals>.emit_block.<locals>.<genexpr>@  s*      22qN1NNN222222r   )formatr!   )declss    r	   
emit_blockz'_list_supported_ops.<locals>.emit_block>  s8    HOOGG22E22222
 
 	
r   r   `-r   r   ~z.. _:r   )
rL   rb   rw   r   rz   replacelowerr   r   r-   )r   bodyop_gathering_fnsrh   headeritemslink_targetr   s           r	   _list_supported_opsr   =  s'   
 
 

 D!   nnS"--55c2>>DDFFNNsTWXXeS!! 	LAA3V#4AAAAAGGKK3V#4KK

58I8IKKG''''&07:Kr   )r   r0   )rT   r   	torch.jitr?   torch.jit._builtinsr   r
   r   r   r$   r'   r/   r:   rL   rb   rj   rm   rw   rz   r   r   __doc__r   r   r	   <module>r      s:         - - - - - -> > >    R R R     @ @ @
 
 
 
/ / /.(4 (4 (4V  ," " "6 6 6$( ( (.v0 v0 v0r  6 


r   