ó
    Eñix  ã                   óF   • S SK Jr  S SKJr  S SKJr  \ " S S5      5       rg)é    )Ú	dataclass)Úreduce)Ú_remote_devicec                   óŒ   • \ rS rSr% Sr/ SQr\\   \S'   \\   \S'   \	S-  \S'    SS\\   S\\   S\
\	-  S-  4S jjrS	 rS
rg)ÚShardMetadataé   a  
Represents a shard of the overall Tensor including its
offsets, lengths and device placement.

Args:
    shard_offsets(List[int]): Offsets in the original tensor indicating
        the start offsets for this shard. Should have the same rank as
        the original tensor.
    shard_sizes(List[int]): Integers indicating the size of each
        dimension for this shard. Should have the same rank as the
        original tensor.
    placement(:class:`torch.distributed._remote_device`):
        Specifies the placement of this shard.
)Úshard_offsetsÚshard_sizesÚ	placementr	   r
   Nr   c                 óì  • Xl         X l        [        U[        5      (       a  [	        U5      U l        OX0l        [        U R                   5      [        U R                  5      :w  a/  [        S[        U R                   5       SU R                   S35      e[        [        U R                   5      5       H?  nU R                   U   S:  a  [        S5      eU R                  U   S:  d  M6  [        S5      e   g )NzMshard_offsets and shard_sizes should have the same number of elements, found z and z respectivelyr   zshard_offsets should be >=0zshard_sizes should be >= 0)	r	   r
   Ú
isinstanceÚstrr   r   ÚlenÚ
ValueErrorÚrange)Úselfr	   r
   r   Úis        Ú^/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/distributed/_shard/metadata.pyÚ__init__ÚShardMetadata.__init__   sâ   € ð +ÔØ&ÔÜ�i¤×%Ñ%Ü+¨IÓ6ˆD�Nà&ŒNÜˆt×!Ñ!Ó"¤c¨$×*:Ñ*:Ó&;Ó;Üð6Ü69¸$×:LÑ:LÓ6MÐ5Nð OØ×'Ñ'Ð(¨ð7óð ô ”s˜4×-Ñ-Ó.Ö/ˆAØ×!Ñ! !Ñ$ qÓ(Ü Ð!>Ó?Ð?Ø×Ñ Ñ" QÕ&Ü Ð!=Ó>Ð>ò	 0ó    c                 óˆ   • S n[        XR                  S5      n[        XR                  U5      nU" X R                  5      nU$ )Nc                 ó$   • U S-  [        U5      -   $ )Nr   )Úhash)ÚaÚbs     r   Ú_hash_reduceÚ,ShardMetadata.__hash__.<locals>._hash_reduce9   s   € Ø˜‘Fœd 1›gÑ%Ð%r   é%   )r   r	   r
   r   )r   r   Úress      r   Ú__hash__ÚShardMetadata.__hash__8   s@   € ò	&ô �\×#5Ñ#5°rÓ:ˆÜ�\×#3Ñ#3°SÓ9ˆÙ˜3§¡Ó/ˆØˆ
r   )r   r	   r
   )N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú	__slots__ÚlistÚintÚ__annotations__r   r   r   r!   Ú__static_attributes__© r   r   r   r      sj   ‡ ñò >€Ià˜‘9ÓØ�c‘ÓØ Ñ$Ó$ð 26ñ	?à˜C‘yð?ð ˜#‘Yð?ð ˜Ñ'¨$Ñ.õ	?õ2r   r   N)Údataclassesr   Ú	functoolsr   Útorch.distributed.remote_devicer   r   r-   r   r   Ú<module>r1      s'   ðå !Ý å :ð ÷6ð 6ó ñ6r   