U
    ªÊ¹jÑ  ã                   @   sB  d dl m  mZ d dlm  mZ d dlm  mZ d dl	m
Z
mZ d dlmZ d dlmZ d dlZd dlmZmZmZmZmZ d dlZd7dd„Zd8dd	„Zd9d
d„Zd:ddœee
eeedœdd„Zd;eeeedœdd„Zd<eeeedœdd„Zddœeedœdd„Zdddœeeeeedœdd„Z d=ddddœeee!ee! f ee! dœd d!„Z"d>dd"œeeeed#œd$d%„Z#d?d&d'„Z$d(d)œeeed*œd+d,„Z%d@ej&ed-œd.d/„ZdAej&ed-œd0d1„Z'd2d3„ Z(eeejd4ƒ eeejƒ eeƒ eeƒ ee ƒ ee"ƒ ee#ƒ ee$ƒ ee%ƒ eeejd5ƒ ee'ejd5ƒ ee(ej(d6ƒ dS )Bé    N)Ú	in_dims_tÚ
out_dims_t)Ú	argnums_t)ÚAnyÚCallableÚOptionalÚTupleÚUnionFc                 C   s8   |d krd| › �}d| › d|› d�}|r4|  dd¡}|S )Nztorch.func.zZWe've integrated functorch into PyTorch. As the final step of the 
integration, functorch.zi 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/master/func.migrating.htmlÚ
Ú )Úreplace)ÚapiÚnew_apiÚreplace_newlinesÚwarning© r   úZ/var/www/html/bwave/python/venv/lib/python3.8/site-packages/torch/_functorch/deprecated.pyÚget_warning   s    
ÿr   c                 C   s    t | |dd�}tj|dd� d S )NT)r   é   )Ú
stacklevel)r   ÚwarningsÚwarn)r   r   r   r   r   r   Úwarn_deprecated$   s    r   c                 C   s\   | j }|d krtt|ƒ}|jd kr&d S t||ƒ}dt |d¡ }t |d¡}|j| | _d S )Nz
.. warning::

z    )Ú__name__ÚgetattrÚ_implÚ__doc__r   ÚtextwrapÚindent)Zfunctorch_apiZtorch_func_apiZnew_api_nameZapi_namer   Zwarning_noter   r   r   Ú
setup_docs)   s    


r   Úerror©Ú
chunk_size)ÚfuncÚin_dimsÚout_dimsÚ
randomnessÚreturnc                C   s   t ddƒ tj| ||||d�S )NÚvmapú
torch.vmapr!   )r   Úapisr(   )r#   r$   r%   r&   r"   r   r   r   r(   6   s    
r(   )r#   ÚargnumsÚhas_auxr'   c                 C   s   t dƒ t | ||¡S )NÚgrad)r   r*   r-   ©r#   r+   r,   r   r   r   r-   @   s    r-   c                 C   s   t dƒ t | ||¡S )NÚgrad_and_value)r   r   r/   r.   r   r   r   r/   D   s    r/   )r,   )r#   r,   c                G   s   t dƒ tj| f|žd|iŽS )NÚvjpr,   )r   r   r0   )r#   r,   Úprimalsr   r   r   r0   H   s    r0   ©Ústrictr,   ©r#   r1   Ztangentsr3   r,   c                C   s   t dƒ tj| ||||d�S )NÚjvpr2   )r   r   r5   r4   r   r   r   r5   L   s    r5   ©r,   r"   Ú_preallocate_and_copy)r#   r+   r"   c                C   s   t dƒ tj| ||||d�S )NÚjacrevr6   )r   r   r8   )r#   r+   r,   r"   r7   r   r   r   r8   P   s    ÿr8   ©r&   ©r#   r+   r,   r&   c                C   s   t dƒ tj| |||d�S )NÚjacfwdr9   )r   r   r;   r:   r   r   r   r;   W   s    r;   c                 C   s   t dƒ tj| |d�S )NÚhessian)r+   )r   r   r<   )r#   r+   r   r   r   r<   [   s    r<   Z	mutations©Úremove)r#   r>   r'   c                C   s   t dƒ tj| |d�S )NÚfunctionalizer=   )r   r   r?   )r#   r>   r   r   r   r?   _   s    r?   ©ÚmodelZdisable_autograd_trackingc                 C   s   t ddƒ t | |¡S )NÚmake_functionalútorch.func.functional_call)r   Ú_nn_implrB   r@   r   r   r   rB   c   s    
rB   c                 C   s   t ddƒ t | |¡S )NÚmake_functional_with_buffersrC   )r   rD   rE   r@   r   r   r   rE   g   s    
rE   c                 C   s   t ddƒ t | ¡S )NÚcombine_state_for_ensembleútorch.func.stack_module_state)r   rD   rF   )Úmodelsr   r   r   rF   k   s    
rF   r)   rC   rG   )NF)N)NN)r   r   r    )r   F)r   F)r   )r   F)r   )F)F))Ztorch._functorch.apisZ
_functorchr*   Z!torch._functorch.eager_transformsZeager_transformsr   Z torch._functorch.make_functionalrB   rD   Ztorch._functorch.vmapr   r   r   Ztorch.nnÚnnr   Útypingr   r   r   r   r	   r   r   r   r   Ústrr(   Úboolr-   r/   r0   r5   Úintr8   r;   r<   r?   ÚModulerE   rF   r   r   r   r   Ú<module>   sr   


   üúú
þÿ
ÿÿÿ