
    קgZ                     n   d Z ddlZddlZddlmZmZmZmZmZ ddl	m
c mZ ddlm
c mZ ddlm
c mZ ddlmZ ddlmZ ddlmZmZ d/dZd0dZd1d	Z	 	 	 d2dddededededef
dZd3dedededefdZ	 d3dedededefdZdddedefdZ ddddededededef
dZ!	 d4dddddedee"ee"         f         dee"         fdZ#	 	 d3d
d dedededefd!Z$d4d"Z%d#d$ded%edefd&Z&d5d'ej'        d(efd)Z	 d5d'ej'        d(efd*Z(d+ Z) eeej        d,            eeej                    eeej                    ee             ee!            ee#            ee$            ee%            ee&            eeej        d-            ee(ej        d-            ee)ej)        d.           dS )6a$  
The APIs in this file are exposed as `functorch.*`. They are thin wrappers
around the torch.func.* APIs that have deprecation warnings -- we're trying
to move people to the torch.func.* equivalents.

NB: We don't use *args, **kwargs in the signatures because that changes the
documentation.
    N)AnyCallableOptionalTupleUnion)	argnums_t)	in_dims_t
out_dims_tFc                 V    |d|  }d|  d| d}|r|                     dd          }|S )Nztorch.func.z[We've integrated functorch into PyTorch. As the final step of the 
integration, `functorch.zk` is deprecated as of PyTorch 
2.0 and will be deleted in a future version of PyTorch >= 2.3. 
Please use `z` instead; see the PyTorch 2.0 release notes 
and/or the `torch.func` migration guide for more details 
https://pytorch.org/docs/main/func.migrating.html
 )replace)apinew_apireplace_newlineswarnings       W/var/www/html/ai-engine/env/lib/python3.11/site-packages/torch/_functorch/deprecated.pyget_warningr      sa    %%%	=#&	= 	= 	= 	= 	=   ,//$++N    c                 b    t          | |d          }t          j        |t          d           d S )NT)r      )
stacklevel)r   warningswarnFutureWarning)r   r   r   s      r   warn_deprecatedr   '   s3    #w>>>GM'=Q777777r   c                     | j         }|t          t          |          }|j        d S t	          ||          }dt          j        |d          z   }t          j        |d          }|j        |z   | _        d S )Nz
.. warning::

z    )__name__getattr_impl__doc__r   textwrapindent)functorch_apitorch_func_apinew_api_nameapi_namer   warning_notes         r   
setup_docsr)   ,   sy    %H 11%(L11G'(/'6*J*JJL?<88L*2\AMr   error
chunk_sizefuncin_dimsout_dims
randomnessreturnc                T    t          dd           t          j        | ||||          S )Nvmap
torch.vmapr+   )r   apisr3   )r-   r.   r/   r0   r,   s        r   r3   r3   :   s/     FL)))9T7HjZPPPPr   argnumshas_auxc                 L    t          d           t          j        | ||          S )Ngrad)r   r5   r9   r-   r6   r7   s      r   r9   r9   F   s$    F9T7G,,,r   c                 L    t          d           t          j        | ||          S )Ngrad_and_value)r   r5   r<   r:   s      r   r<   r<   K   s(     $%%%tWg666r   )r7   c                J    t          d           t          j        | g|R d|iS )Nvjpr7   )r   r    r>   )r-   r7   primalss      r   r>   r>   R   s0    E9T5G555W555r   strictr7   r?   tangentsrA   c                R    t          d           t          j        | ||||          S )Njvpr@   )r   r    rD   )r-   r?   rB   rA   r7   s        r   rD   rD   W   s-     E9T7HVWMMMMr   r7   r,   _preallocate_and_copyr,   c                R    t          d           t          j        | ||||          S )NjacrevrE   )r   r    rH   )r-   r6   r7   r,   rF   s        r   rH   rH   c   s:     H<3   r   r0   c                P    t          d           t          j        | |||          S )NjacfwdrI   )r   r    rK   )r-   r6   r7   r0   s       r   rK   rK   u   s+     H<gw:FFFFr   c                 L    t          d           t          j        | |          S )Nhessian)r6   )r   r    rM   )r-   r6   s     r   rM   rM      s%    I=w////r   	mutationsremoverP   c                L    t          d           t          j        | |          S )NfunctionalizerO   )r   r    rR   )r-   rP   s     r   rR   rR      s&    O$$$tF3333r   modeldisable_autograd_trackingc                 L    t          dd           t          j        | |          S )Nmake_functionaltorch.func.functional_call)r   _nn_implrV   rS   rT   s     r   rV   rV      s(    %'CDDD#E+DEEEr   c                 L    t          dd           t          j        | |          S )Nmake_functional_with_buffersrW   )r   rX   r[   rY   s     r   r[   r[      s*     24PQQQ08QRRRr   c                 J    t          dd           t          j        |           S )Ncombine_state_for_ensembletorch.func.stack_module_state)r   rX   r]   )modelss    r   r]   r]      s%    02QRRR.v666r   r4   rW   r^   )NF)N)NN)r   r   r*   )r   F)r   )F)*r!   r"   r   typingr   r   r   r   r   torch._functorch.apis
_functorchr5   !torch._functorch.eager_transformseager_transformsr     torch._functorch.make_functionalrV   rX   torch.nnnnr   torch._functorch.vmapr	   r
   r   r   r)   strr3   boolr9   r<   r>   rD   intrH   rK   rM   rR   Moduler[   r]    r   r   <module>rn      s      8 8 8 8 8 8 8 8 8 8 8 8 8 8 $ $ $ $ $ $ $ $ $ 1 1 1 1 1 1 1 1 1 3 3 3 3 3 3 3 3 3       7 7 7 7 7 7 7 7 7 7 7 7 7 7    8 8 8 8
B B B B  		Q 	Q 	Q 	Q
	Q	Q 	Q 		Q 	Q 	Q 	Q 	Q- -x -) -$ -8 - - - - =B7 7
7&75977 7 7 7 38 6 6 6h 64 6 6 6 6 	N 	N 	N
	N	N 	N
 	N 	N 	N 	N 	N '(  $  
3c
?#
    ( G
 G G G
GG G
 G G G G0 0 0 0
 4? 4 4 4 4S 48 4 4 4 4
F F29 F F F F F 9>S S9S15S S S S7 7 7
 
4L ) ) ) 

4    

>4. / / / 

3 

3 

6    

6    

7    

=    

?H46R S S S 

 (":<X   
'#    r   