
    sg(                         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y)    N)_find_builtinc                 L    | j                  d      xr | j                  d       S )N___)
startswith)names    J/var/www/html/venv/lib/python3.12/site-packages/torch/jit/supported_ops.py_hiddenr
      s"    ??3=(=$==    c                     t        |       S N)str)types    r	   
_emit_typer      s    t9r   c                     |j                    dt        |j                         }|j                  }|| dt	        |       }|dkD  r
dd| z   | }|S )Nz : =r   
 )r   r   r   default_valuer   )indentiargvdefaults        r	   	_emit_argr      se    88*C
388,-.AGc3w<.!1uvqc"Hr   c                 J     dj                   fdt        |      D              S )N,c              3   >   K   | ]  \  }}t        ||        y wr   )r   ).0r   r   r   s      r	   	<genexpr>z_emit_args.<locals>.<genexpr>!   s     Q&!SIfa-Qs   )join	enumerate)r   	argumentss   ` r	   
_emit_argsr$       s    88QIi<PQQQr   c                 ,    t        | j                        S r   )r   r   )rets    r	   	_emit_retr'   $   s    chhr   c                 r    t        |       dk(  rt        | d         S ddj                  d | D               dS )N   r   zTuple[z, c              3   2   K   | ]  }t        |        y wr   )r'   )r   rs     r	   r    z_emit_rets.<locals>.<genexpr>+   s     <qil<s   ])lenr'   r!   )returnss    r	   
_emit_retsr/   (   s<    
7|q$$DII<G<<=Q??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_schemar9   .   ss    
{5$

Js>*Q.8&:J:J9::VWX Y()	+ 
 r   c            
         d } g }t        t        j                        D ]^  }t        |      rt        j                  j                  d|z         }|D ])  } | |      s|j                  t        d||d             + ` d|fS )Nc                     t        | j                        dk(  ry| j                  d   }|j                  dk7  ry|j                  j	                  t
        j                  j                  j                               syy)Nr   FselfT)	r-   r#   r   r   isSubtypeOftorch_C
TensorTypeget)r4   r<   s     r	   is_tensor_methodz)_get_tensor_ops.<locals>.is_tensor_method<   sb    v A%"99yy$$UXX%8%8%<%<%>?r   aten::Tensorr)   )r5   zSupported Tensor Methods)dirr>   rD   r
   r?   _jit_get_schemas_for_operatorappendr9   )rB   methodselemschemasr4   s        r	   _get_tensor_opsrK   ;   s     GELL! Vt}hh<<X_MG! V#F+NN<$RS#TUVV &w..r   c            
      j   g } t         j                  j                  }|j                  }t	        t         j                  j                        D ]  }t        ||      }t        j                  |      rt        |d         r3t        j                  |      }|st        d| d      d|j                  vrh	 t         j                  j                  |      }|j                  }| j                  t        |||              t         j                  j                   j"                  D ]  }|j                  }t	        |      D ]h  }t%        t        ||            }|t         j&                  j)                  |      }	|	D ]*  }
t        |      r| j                  t        |||
             , j  d| fS #  Y fxY w)Nr   Module for 
 not foundztorch.nn.functionalzSupported PyTorch Functions)r>   nn
functional__name__rE   getattrinspect
isfunctionr
   	getmoduleRuntimeErrorjitscriptr4   rG   r9   	_builtins_modules_containing_builtinsr   r?   rF   )	functionsr3   r   rI   attrattr_modulescriptedscripted_schemabuiltinrJ   r4   s              r	   _get_nn_functional_opsra   R   s   I ((

C<<DEHH''( sD!!!$'747+;''-TF*=>> (<(<<	yy''-H&ooO\$oFG%0 yy""?? 	K||H 	KD#GC$67G"((@@I% KF"4=!((dD&)IJK		K	K ))33	s   5AF--F2c                  p   g } t         j                  j                  j                  D ]  \  }}t	        j
                  |      }t        |d      s(|s+t        |j                        s*t        |j                        st        |j                        rkd|j                  v rz| j                  ||f        | S )NrQ   ztorch._C)r>   rW   rY   _builtin_opsrS   rU   hasattrr
   rQ   __qualname__rG   )builtinsfn_builtin_namer3   s       r	   _get_builtins_helperri   }   s    H"YY00== -M#r:&2;;72??#;ws||?T%]+,-" Or   c                 l    t        j                  |       }|st        d|  d      |j                  dk(  S )NrM   rN   math)rS   rU   rV   rQ   )rg   r3   s     r	   _is_math_fnrl      s8    


B
C[J788<<6!!r   c            	      v   g } t        d t                     }t        |      }|D ]  \  }}t        j                  |      }|st        d| d      t        |      }|:t        j                  j                  |      }|D ]2  }| j                  t        |j                  |j                  |             4  d| fS )Nc                      t        | d          S Nr   rl   rg   s    r	   <lambda>z+_get_torchscript_builtins.<locals>.<lambda>   s    [A%7!7 r   rM   rN   zTorchScript Builtin Functions)filterri   listrS   rU   rV   r   r>   r?   rF   rG   r9   rQ   )	r[   rf   builtins_listrg   rh   r3   r`   rJ   r4   s	            r	   _get_torchscript_builtinsrv      s    I79M9OPHNM* RM#RD
;<<#hh<<WEG! R  cllBKK!PQRR +I55r   c                     g } t        d t                     }t        |      }|D ]  \  }}t        j                  |      }|st        d| d      t        |      }|:t        j                  j                  |      }|D ]9  }t        |j                  |j                  |      }	d|	v r)| j                  |       ;  d| fS )Nc                     t        | d         S ro   rp   rq   s    r	   rr   z$_get_math_builtins.<locals>.<lambda>   s    RU!3 r   rM   rN   rD   z``math`` Module)rs   ri   rt   rS   rU   rV   r   r>   r?   rF   r9   rQ   rG   )
r[   rf   ru   rg   rh   r3   r`   rJ   r4   r8   s
             r	   _get_math_builtinsry      s    I35I5KLHNM* )M#RD
;<<#hh<<WEG! ))#,,V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 ]  \  }}|j                  d| d| d        g }g }| D ]  }d| }	||v r||   }	t        j                  j                  |	      }
|
D ]   }|j                  t	        d ||d             " t        |
      dkD  r|j                  d       ud| d||    d}|j                  |        dj                  |      }dj                  |      }dj                  |      }t        j                  |d      }t        j                  |d      }t        j                  |d      }d| d| d | d!}d"|fS )#N)printtuplefloatcomplexintboolr   rR   rd   
isinstancer-   hexoctroundhashminmaxabsalldivmodrt   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|   rR   rd   r   r   r"   r   ))r~   __complex__)r}   	__float__)r   __int__)r   __bool__)r   __str__)r-   __len__)r   __hex__)r   __oct__"z", "``z``"rC   r   )r6    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)	rG   r>   r?   rF   r9   r-   r!   textwrapr   )supported_builtins
op_renamesschemaless_op_explanationsmagic_methodsmagic_methods_rowsrg   magic_methodschematized_opsschemaless_opsop_namerJ   s	table_rowschematized_ops_strschemaless_ops_strmagic_methods_rows_strsections                    r	   _get_global_builtinsr      s   @ "'	J #p<<(^d@	"	M ) CL!!AbT~S"ABC ON  -2$- nG((88A 	IA""<b!Q#GH	Iw<!""2& -RD6PQS6T5UUVW  !!),- ))O4>2!YY'9:"//*=tD!);TB%__-CTJ         +G0 '//r   c                     d } d}t         t        t        t        t        f}|D ]  } |       \  }}|j                  dd      j                  dd      j                         j                  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                 P    dj                  dj                  d | D                    S )Nz1
.. rst-class:: codeblock-height-limiter

::

{}
r   c              3   (   K   | ]
  }d | d  yw)z    

N )r   ds     r	   r    z:_list_supported_ops.<locals>.emit_block.<locals>.<genexpr>@  s     2qd1#TN2s   )formatr!   )declss    r	   
emit_blockz'_list_supported_ops.<locals>.emit_block>  s'    HOOGG2E22
 	
r   r   `-r   r   ~z.. _:r   )
rK   ra   rv   r   ry   replacelowerr   r   r-   )r   bodyop_gathering_fnsrg   headeritemslink_targetr   s           r	   _list_supported_opsr   =  s    

 D!  nnS"-55c2>DDFNNsTWXeS!3V#4"5RwbAG3V#4"5R
58I7JKGQ'&07: Kr   )r      )rS   r   	torch.jitr>   torch.jit._builtinsr   r
   r   r   r$   r'   r/   r9   rK   ra   ri   rl   rv   ry   r   r   __doc__r   r   r	   <module>r      sk       ->R @
/.(4V,"6$(.v0r6 
r   