Ë
    f^(h¤  ã                   ó:   — d dl Z d dlmZ d dlmZ  G d„ de«      Zy)é    N)ÚProxyTorchDispatchMode)ÚTorchFunctionModec                   ó   — e Zd ZdZdd„Zy)ÚAutogradStateOpsFailSafeguarda  
    Detect grad state ops during exporting the graph and fail the process by
    raising an error, to avoid unexpected behavior. Those grad mode ops could be:
    `torch.no_grad`
    `torch.enable_grad`
    `torch.set_grad_enabled`

    Export with predispatch mode is exempted.
    Nc                 ó¨  — |xs i }t         j                  j                  g}t         j                  j                  «       }||v rˆt	        |«      dk(  sJ ‚|d   }t         j                  j                  t         j                  j                  j                  «      }|r0t        |t        «      r |j                  s||k7  rt        d|› d�«      ‚ ||i |¤ŽS )Né   r   z&Encountered autograd state manager op zÿ trying to change global autograd state while exporting. This is unsafe because we don't capture this op in torch.export today, hence we can't reflect the user intention soundly. You can fix this by adding a torch.no_grad() context around the export call.)ÚtorchÚ_CÚ_set_grad_enabledÚis_grad_enabledÚlenÚ_get_dispatch_modeÚ_TorchDispatchModeKeyÚPROXYÚ
isinstancer   Úpre_dispatchÚRuntimeError)	ÚselfÚfuncÚtypesÚargsÚkwargsÚunsupported_grad_mode_opsÚcurrent_stateÚchanged_stateÚmodes	            úU/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/torch/export/_safeguard.pyÚ__torch_function__z0AutogradStateOpsFailSafeguard.__torch_function__   sÎ   € Ø’˜2ˆä�H‰H×&Ñ&ð%
Ð!ô
 Ÿ™×0Ñ0Ó2ˆØÐ,Ñ,Ü�t“9 ’>Ð!�>Ø  ™GˆMÜ—8‘8×.Ñ.¬u¯x©x×/MÑ/M×/SÑ/SÓTˆDñ Ü˜tÔ%;Ô<Ø×)Ò)Ø! ]Ò2ä"Ø<¸T¸Fð COð Oóð ñ �TÐ$˜VÑ$Ð$ó    )© N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r    r   r   r   r      s   „ ñô%r   r   )r	   Ú"torch.fx.experimental.proxy_tensorr   Útorch.overridesr   r   r    r   r   ú<module>r'      s   ðã Ý EÝ -ô%%Ð$5õ %%r   