+
    ˜°³j#  ã                   ó´   € R t ^ RIt^ RIt^ RIHt R.t]P                  ! ]4      tR R lt	]R 4       t
]
P                  R 4       t]
P                  R 4       tR# )	aQ  Compile-safe backward gradient logging for multiple tensors.

``debug_grad_log`` logs gradient norms during backward for one or more tensors.
It is a leaf function with a ``register_multi_grad_hook`` that fires exactly
once when all requires_grad tensor inputs have their gradients computed.

Example::

    import torch
    from torch.utils.debug_log import debug_grad_log

    x = torch.randn(4, requires_grad=True)
    y = torch.randn(4, requires_grad=True)
    z = x * 2 + y * 3

    debug_grad_log(x, y)

    z.sum().backward()
    # Logs: [rank 0][bwd] t0_grad_norm=... t1_grad_norm=...
N)Úleaf_functionÚdebug_grad_logc                ó$   € V ^8„  d   QhR\         /# )é   Úreturn)Úint)Úformats   "ÚV/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/utils/debug_log.pyÚ__annotate__r
   !   s   € ÷ ;ñ ;”3ñ ;ó    c                  óª   € \         P                  P                  4       '       g   ^ # ^ RIHp  V P	                  4       '       d   V P                  4       # ^ # )é    N)ÚtorchÚdistributedÚis_availableÚtorch.distributedÚis_initializedÚget_rank)Údists    r	   Ú	_get_rankr   !   s<   € Ü×Ñ×)Ñ)×+Ò+ÙÝ$à"×1Ñ1×3Ò3ˆ4�=‰=‹?Ð:¸Ð:r   c                 ó   € R# )a‰  Log gradient norms of multiple tensors during backward.

This is a no-op in the forward pass. During backward, the hook fires
exactly once when all requires_grad tensor inputs have their gradients
computed, and logs ``[rank R][bwd] t0_grad_norm=... t1_grad_norm=...``.

Args:
    *tensors: One or more tensors to monitor.

Returns:
    None. Call without assignment: ``debug_grad_log(x, y)``.
N© ©Útensorss   *r	   r   r   )   s   € ñ r   c                  ó   € R # )Nr   r   s   *r	   Ú_debug_grad_log_faker   :   s   € ár   c                  ó†   € R P                  R \        V 4       4       4      p\        P                  R\	        4       V4       R# )Ú c              3   óp   "  € T F,  w  rR V RVP                  4       P                  4       R 2x € K.  	  R# 5i)Útz_grad_norm=z.4fN)ÚnormÚitem)Ú.0ÚiÚgs   &  r	   Ú	<genexpr>Ú'_debug_grad_log_hook.<locals>.<genexpr>A   s2   é € ð Ù<L±D°Aˆ!ˆAˆ3ˆk˜!Ÿ&™&›(Ÿ-™-›/¨#Ð.Õ/Ó<Lùs   ‚46z[rank %d][bwd] %sN)ÚjoinÚ	enumerateÚlogÚinfor   )ÚgradsÚnormss   * r	   Ú_debug_grad_log_hookr-   ?   s7   € à�H‰Hñ Ü<EÀeÔ<Lóó €Eô ‡H�HÐ ¤)£+¨uÖ5r   )Ú__doc__Úloggingr   Útorch._dynamo.decoratorsr   Ú__all__Ú	getLoggerÚ__name__r)   r   r   Úregister_faker   Úregister_multi_grad_hookr-   r   r   r	   Ú<module>r6      s|   ðñó* ã Ý 2ð Ð
€à×Ò˜Ó!€õ;ð ñó ðð  ×Ññó ðð ×(Ñ(ñ6ó )ò6r   