+
    ˜°³j3  ã                   ó�   € ^ RI t ^ RIHt ^ RIHt ^ RIt^ RIHt ^ RI	H
t
 ^ RIHt R.t]! RRR	7      t ! R
 R]],          4      tR# )é    N)ÚIterator)ÚTypeVar)ÚDataset)ÚSamplerÚDistributedSamplerÚ_T_coT)Ú	covariantc                   óp   a € ] tR t^t o RtRV 3R lR lltV 3R lR ltV 3R lR ltV 3R	 lR
 ltRt	V t
R# )r   a‡  Sampler that restricts data loading to a subset of the dataset.

It is especially useful in conjunction with
:class:`torch.nn.parallel.DistributedDataParallel`. In such a case, each
process can pass a :class:`~torch.utils.data.DistributedSampler` instance as a
:class:`~torch.utils.data.DataLoader` sampler, and load a subset of the
original dataset that is exclusive to it.

.. note::
    Dataset is assumed to be of constant size and that any instance of it always
    returns the same elements in the same order.

Args:
    dataset: Dataset used for sampling.
    num_replicas (int, optional): Number of processes participating in
        distributed training. By default, :attr:`world_size` is retrieved from the
        current distributed group.
    rank (int, optional): Rank of the current process within :attr:`num_replicas`.
        By default, :attr:`rank` is retrieved from the current distributed
        group.
    shuffle (bool, optional): If ``True`` (default), sampler will shuffle the
        indices.
    seed (int, optional): random seed used to shuffle the sampler if
        :attr:`shuffle=True`. This number should be identical across all
        processes in the distributed group. Default: ``0``.
    drop_last (bool, optional): if ``True``, then the sampler will drop the
        tail of the data to make it evenly divisible across the number of
        replicas. If ``False``, the sampler will add extra indices to make
        the data evenly divisible across the replicas. Default: ``False``.

.. warning::
    In distributed mode, calling the :meth:`set_epoch` method at
    the beginning of each epoch **before** creating the :class:`DataLoader` iterator
    is necessary to make shuffling work properly across multiple epochs. Otherwise,
    the same ordering will be always used.

Example::

    >>> # xdoctest: +SKIP
    >>> sampler = DistributedSampler(dataset) if is_distributed else None
    >>> loader = DataLoader(dataset, shuffle=(sampler is None),
    ...                     sampler=sampler)
    >>> for epoch in range(start_epoch, n_epochs):
    ...     if is_distributed:
    ...         sampler.set_epoch(epoch)
    ...     train(loader)
Nc                ó^   <€ V ^8„  d   QhRS[ RS[R,          RS[R,          RS[RS[RS[RR/# )	é   ÚdatasetÚnum_replicasNÚrankÚshuffleÚseedÚ	drop_lastÚreturn)r   ÚintÚbool)ÚformatÚ__classdict__s   "€Ú]/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/utils/data/distributed.pyÚ__annotate__ÚDistributedSampler.__annotate__B   sY   ø€ ÷ 'ñ 'áð'ñ ˜D•jð'ñ �D�jð	'ñ
 ð'ñ ð'ñ ð'ð 
ñ'ó    c                ó‚  € Vf<   \         P                  ! 4       '       g   \        R4      h\         P                  ! 4       pVf<   \         P                  ! 4       '       g   \        R4      h\         P                  ! 4       pW28¼  g   V^ 8  d   \        RV RV^,
           R24      hWn        W n        W0n        ^ V n	        W`n
        V P                  '       d}   \        V P                  4      V P                  ,          ^ 8w  dR   \        P                  ! \        V P                  4      V P                  ,
          V P                  ,          4      V n        M?\        P                  ! \        V P                  4      V P                  ,          4      V n        V P                  V P                  ,          V n        W@n        WPn        R # )Nz,Requires distributed package to be availablezInvalid rank z%, rank should be in the interval [0, Ú])ÚdistÚis_availableÚRuntimeErrorÚget_world_sizeÚget_rankÚ
ValueErrorr   r   r   Úepochr   ÚlenÚmathÚceilÚnum_samplesÚ
total_sizer   r   )Úselfr   r   r   r   r   r   s   &&&&&&&r   Ú__init__ÚDistributedSampler.__init__B   sT  € ð ÒÜ×$Ò$×&Ò&Ü"Ð#QÓRÐRÜ×.Ò.Ó0ˆLØŠ<Ü×$Ò$×&Ò&Ü"Ð#QÓRÐRÜ—=’=“?ˆDØÔ 4¨!¤8ÜØ ˜vÐ%JÈ<ÐZ[ÕK[ÐJ\Ð\]Ð^óð ð ŒØ(ÔØŒ	ØˆŒ
Ø"Œð �>�>ˆ>œc $§,¡,Ó/°$×2CÑ2CÕCÀqÔHô  $ŸyšyÜ�T—\‘\Ó" T×%6Ñ%6Õ6¸$×:KÑ:KÕKó ˆDÕô  $Ÿyšy¬¨T¯\©\Ó):¸T×=NÑ=NÕ)NÓOˆDÔØ×*Ñ*¨T×->Ñ->Õ>ˆŒØŒØŽ	r   c                ó0   <€ V ^8„  d   QhRS[ S[,          /# ©r   r   )r   r   )r   r   s   "€r   r   r   k   s   ø€ ÷ "ñ "™(¡5�/ñ "r   c                óî  € V P                   '       d|   \        P                  ! 4       pVP                  V P                  V P
                  ,           4       \        P                  ! \        V P                  4      VR 7      P                  4       pM'\        \        \        V P                  4      4      4      pV P                  '       gp   V P                  \        V4      ,
          pV\        V4      8:  d   W"RV ,          pMFW"\        P                  ! V\        V4      ,          4      ,          RV ,          pMVRV P                   p\        V4      V P                  8w  d&   \!        R\        V4       RV P                   R24      hW P"                  V P                  V P$                  1,          p\        V4      V P&                  8w  d&   \!        R\        V4       RV P&                   R24      h\)        V4      # ))Ú	generatorNzNumber of indices (z) does not match total_size (Ú)zNumber of subsampled indices (z) does not match num_samples ()r   ÚtorchÚ	GeneratorÚmanual_seedr   r$   Úrandpermr%   r   ÚtolistÚlistÚranger   r)   r&   r'   ÚAssertionErrorr   r   r(   Úiter)r*   ÚgÚindicesÚpadding_sizes   &   r   Ú__iter__ÚDistributedSampler.__iter__k   s…  € Ø�<�<ˆ<ä—’Ó!ˆAØ�M‰M˜$Ÿ)™) d§j¡jÕ0Ô1Ü—n’n¤S¨¯©Ó%6À!ÔD×KÑKÓM‰Gäœ5¤ T§\¡\Ó!2Ó3Ó4ˆGà�~�~ˆ~àŸ?™?¬S°«\Õ9ˆLØœs 7›|Ô+Ø = LÐ1Õ1‘à¤d§i¢i°¼sÀ7»|Õ0KÓ&LÕLØ!�\ðõ ‘ð
 Ð/ §¡Ð0ˆGÜˆw‹<˜4Ÿ?™?Ô*Ü Ø%¤c¨'£l ^Ð3PÐQU×Q`ÑQ`ÐPaÐabÐcóð ð
 Ÿ)™) d§o¡o¸×8IÑ8IÐIÕJˆÜˆw‹<˜4×+Ñ+Ô+Ü Ø0´°W³°Ð>\Ð]a×]mÑ]mÐ\nÐnoÐpóð ô
 �G‹}Ðr   c                ó    <€ V ^8„  d   QhRS[ /# r.   ©r   )r   r   s   "€r   r   r   �   s   ø€ ÷  ñ  ™ñ  r   c                ó   € V P                   # )N)r(   )r*   s   &r   Ú__len__ÚDistributedSampler.__len__�   s   € Ø×ÑÐr   c                ó$   <€ V ^8„  d   QhRS[ RR/# )r   r$   r   NrA   )r   r   s   "€r   r   r   ’   s   ø€ ÷ ñ ™sð  tñ r   c                ó   € Wn         R# )zù
Set the epoch for this sampler.

When :attr:`shuffle=True`, this ensures all replicas
use a different random ordering for each epoch. Otherwise, the next iteration of this
sampler will yield the same ordering.

Args:
    epoch (int): Epoch number.
N)r$   )r*   r$   s   &&r   Ú	set_epochÚDistributedSampler.set_epoch’   s	   € ð Ž
r   )	r   r   r$   r   r(   r   r   r   r)   )NNTr   F)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r+   r>   rC   rG   Ú__static_attributes__Ú__classdictcell__)r   s   @r   r   r      s5   ø‡ € ñ.÷`'ò '÷R"ð "÷H ð  ÷ö r   )r&   Úcollections.abcr   Útypingr   r2   Útorch.distributedÚdistributedr   Útorch.utils.data.datasetr   Útorch.utils.data.samplerr   Ú__all__r   r   © r   r   Ú<module>rX      sD   ðÛ Ý $Ý ã Ý  Ý ,Ý ,ð  Ð
 €ñ 	� 4Ô(€ôL˜ �ö Lr   