§
    Ÿ²Åjí  ã                   óh   — d dl mZ d dlmZ d dlmZmZmZ d dlm	Z	 e G d„ d¦  «        ¦   «         Z
dS )é    )Ú	dataclass)Úreduce)ÚListÚOptionalÚUnion)Ú_remote_devicec            
       ó°   — e Zd ZU dZg d¢Zee         ed<   ee         ed<   ee	         ed<   	 d	dee         dee         dee
ee	f                  fd„Zd„ ZdS )
Ú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   r   Nc                 óú  — || _         || _        t          |t          ¦  «        rt	          |¦  «        | _        n|| _        t          | j         ¦  «        t          | j        ¦  «        k    r-t          dt          | j         ¦  «        › d| j        › d�¦  «        ‚t          t          | j         ¦  «        ¦  «        D ]B}| j         |         dk     rt          d¦  «        ‚| j        |         dk     rt          d¦  «        ‚ŒCd S )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        úRC:\Projects\Historical\venv\Lib\site-packages\torch/distributed/_shard/metadata.pyÚ__init__zShardMetadata.__init__    s  € ð +ˆÔØ&ˆÔÝ�i¥Ñ%Ô%ð 	'Ý+¨IÑ6Ô6ˆDŒNˆNà&ˆDŒNÝˆtÔ!Ñ"Ô"¥c¨$Ô*:Ñ&;Ô&;Ò;Ð;Ýð7Ý69¸$Ô:LÑ6MÔ6Mð7ð 7àÔ'ð7ð 7ð 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_reduce:   s   € Ø˜‘F�d 1™gœgÑ%Ð%r   é%   )r   r   r   r   )r   r   Úress      r   Ú__hash__zShardMetadata.__hash__9   sS   € ð	&ð 	&ð 	&õ �\ 4Ô#5°rÑ:Ô:ˆÝ�\ 4Ô#3°SÑ9Ô9ˆØˆl˜3 ¤Ñ/Ô/ˆØˆ
r   )N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   ÚintÚ__annotations__r   r   r   r   r   r"   © r   r   r
   r
   	   s¾   € € € € € € ðð ð >Ð=Ð=€Ià˜”9ÐÐÑØ�c”ÐÐÑØ˜Ô'Ð'Ð'Ñ'ð ;?ð	?ð ?à˜C”yð?ð ˜#”Yð?ð ˜E # ~Ð"5Ô6Ô7ð	?ð ?ð ?ð ?ð2ð ð ð ð r   r
   N)Údataclassesr   Ú	functoolsr   Útypingr   r   r   Útorch.distributed.remote_devicer   r
   r*   r   r   ú<module>r/      s—   ðà !Ð !Ð !Ð !Ð !Ð !Ø Ð Ð Ð Ð Ð Ø (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ð (à :Ð :Ð :Ð :Ð :Ð :ð ð6ð 6ð 6ð 6ð 6ñ 6ô 6ñ „ð6ð 6ð 6r   