Ë
    M²jx  ã                   óF   — d dl mZ d dlmZ d dlmZ e G d„ d«      «       Zy)é    )Ú	dataclass)Úreduce)Ú_remote_devicec                   ó€   — e Zd ZU dZg d¢Zee   ed<   ee   ed<   edz  ed<   	 d	dee   dee   de	ez  dz  fd„Z
d„ Zy)
ÚShardMetadataaH  
    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                 óÞ  — || _         || _        t        |t        «      rt	        |«      | _        n|| _        t        | j                   «      t        | j                  «      k7  r/t        dt        | j                   «      › d| j                  › d�«      ‚t        t        | j                   «      «      D ]<  }| j                   |   dk  rt        d«      ‚| j                  |   dk  sŒ3t        d«      ‚ y )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        ú`/var/www/html/ia-enhanced/venv/lib/python3.12/site-packages/torch/distributed/_shard/metadata.pyÚ__init__zShardMetadata.__init__   sê   € ð +ˆÔØ&ˆÔÜ�i¤Ô%Ü+¨IÓ6ˆD�Nà&ˆDŒNÜˆt×!Ñ!Ó"¤c¨$×*:Ñ*:Ó&;Ò;Üð6Ü69¸$×:LÑ:LÓ6MÐ5Nð OØ×'Ñ'Ð(¨ð7óð ô ”s˜4×-Ñ-Ó.Ó/ò 	?ˆAØ×!Ñ! !Ñ$ qÒ(Ü Ð!>Ó?Ð?Ø×Ñ Ñ" QÓ&Ü Ð!=Ó>Ð>ñ		?ó    c                 óŽ   — d„ }t        || j                  d«      }t        || j                  |«      } ||| j                  «      }|S )Nc                 ó$   — | dz  t        |«      z   S )Né   )Úhash)ÚaÚbs     r   Ú_hash_reducez,ShardMetadata.__hash__.<locals>._hash_reduce9   s   € Ø˜‘Fœd 1›gÑ%Ð%r   é%   )r   r   r	   r
   )r   r   Úress      r   Ú__hash__zShardMetadata.__hash__8   sF   € ò	&ô �\ 4×#5Ñ#5°rÓ:ˆÜ�\ 4×#3Ñ#3°SÓ9ˆÙ˜3 §¡Ó/ˆØˆ
r   )N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__ÚlistÚintÚ__annotations__r   r   r   r   © 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>r,      s'   ðå !Ý å :ð ÷6ð 6ó ñ6r   