
    sho                         S SK r S r\" 5       (       a'  \ R                  R                  5       (       d  \" S5      e\" 5       (       a  S SKJrJrJrJ	r	J
r
JrJrJrJrJrJr   " S S5      rg)    Nc                  6    [        [        R                  S5      $ )N_dist_autograd_init)hasattrtorch_C     w/Users/tiagomarins/Projetos/claudeai/copy_bank/venv/lib/python3.13/site-packages/torch/distributed/autograd/__init__.pyis_availabler      s    588233r	   z/Failed to initialize torch.distributed.autograd)_current_context_get_debug_info_get_max_id_init_is_valid_context_new_context_release_context_retrieve_contextbackwardDistAutogradContextget_gradientsc                   $    \ rS rSrSrS rS rSrg)context   a  
Context object to wrap forward and backward passes when using
distributed autograd. The ``context_id`` generated in the ``with``
statement  is required to uniquely identify a distributed backward pass
on all workers. Each worker stores metadata associated with this
``context_id``, which is required to correctly execute a distributed
autograd pass.

Example::
    >>> # xdoctest: +SKIP
    >>> import torch.distributed.autograd as dist_autograd
    >>> with dist_autograd.context() as context_id:
    >>>     t1 = torch.rand((3, 3), requires_grad=True)
    >>>     t2 = torch.rand((3, 3), requires_grad=True)
    >>>     loss = rpc.rpc_sync("worker1", torch.add, args=(t1, t2)).sum()
    >>>     dist_autograd.backward(context_id, [loss])
c                 T    [        5       U l        U R                  R                  5       $ N)r   autograd_context_context_id)selfs    r
   	__enter__context.__enter__0   s!     ,$$0022r	   c                 J    [        U R                  R                  5       5        g r   )r   r   r   )r   typevalue	tracebacks       r
   __exit__context.__exit__4   s    ..::<=r	   )r   N)__name__
__module____qualname____firstlineno____doc__r   r%   __static_attributes__r   r	   r
   r   r      s    $3>r	   r   )r   r   r   r   RuntimeErrortorch._C._distributed_autogradr   r   r   r   r   r   r   r   r   r   r   r   r   r	   r
   <module>r/      s[    4 >>%((6688
H
II>>   > >r	   