§
    ŠŠtjx  ã                   óT   — d dl mZ d dlmZ d dlmZ e G d„ d¦  «        ¦   «         ZdS )é    )Ú	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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	   Nr
   c                 óú  — || _         || _        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        ú_/var/www/html/CA-Chatbot/venv/lib/python3.11/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_reduce9   s   € Ø˜‘F�d 1™gœgÑ%Ð%r   é%   )r   r   r	   r
   )r   r   Úress      r   Ú__hash__zShardMetadata.__hash__8   sS   € ð	&ð 	&ð 	&õ �\ 4Ô#5°rÑ:Ô:ˆÝ�\ 4Ô#3°SÑ9Ô9ˆØˆl˜3 ¤Ñ/Ô/ˆØˆ
r   )N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__ÚlistÚintÚ__annotations__r   r   r   r   © r   r   r   r      s¹   € € € € € € ðð ð >Ð=Ð=€Ià˜”9ÐÐÑØ�c”ÐÐÑØ Ñ$Ð$Ð$Ñ$ð 26ð	?ð ?à˜C”yð?ð ˜#”Yð?ð ˜Ñ'¨$Ñ.ð	?ð ?ð ?ð ?ð2ð ð ð ð r   r   N)Údataclassesr   Ú	functoolsr   Útorch.distributed.remote_devicer   r   r(   r   r   ú<module>r,      sy   ðà !Ð !Ð !Ð !Ð !Ð !Ø Ð Ð Ð Ð Ð à :Ð :Ð :Ð :Ð :Ð :ð ð6ð 6ð 6ð 6ð 6ñ 6ô 6ñ „ð6ð 6ð 6r   