
    Ph=                         U d Z ddlmZmZmZ ddlZddlmZ ddlmZm	Z	 dgZ
ee   ed<   i Zeeej                  ef   ef   ed	<   d
ej                  dedefdZy)z<Provides phony for arbitrary dependency in a autograd graph.    )DictListTupleN)Tensor   )default_stream
use_stream	get_phony__all___phoniesdevicerequires_gradreturnc                    | |f}	 t         |   }|S # t        $ rO t        t        |             5  t	        j
                  d| |      }ddd       n# 1 sw Y   nxY wt         |<   Y |S w xY w)a  Get a phony. Phony is tensor without space.

    It is useful to make arbitrary dependency in a autograd graph because it doesn't require any
    gradient accumulation.

    .. note::

        Phonies for each device are cached. If an autograd function gets a phony
        internally, the phony must be detached to be returned. Otherwise, the
        autograd engine will mutate the cached phony in-place::

            class Phonify(torch.autograd.Function):
                @staticmethod
                def forward(ctx, input):
                    phony = get_phony(input.device, requires_grad=False)
                    return phony.detach()  # detach() is necessary.

    r   )r   r   N)r   KeyErrorr	   r   torchempty)r   r   keyphonys       pC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\torch/distributed/pipeline/sync/phony.pyr
   r
      so    & =
!C L  v./KK&NE 0// Ls&   	 A)A	A)A	A)(A))__doc__typingr   r   r   r   r   streamr   r	   r   str__annotations__r   r   boolr
        r   <module>r      sl    C $ $   .!]c " 57$uU\\4'(&0
1 6ell d v r   