ó
    !Eñi¹  ã                   ó¢   • S r SSKJr  SSKrSSKJrJr  SSKJr  SS\S\	\
\4   4S	 jjrSS\S\4S
 jjrSS\S\4S jjrSS\SS4S jjr/ SQrg)zKThis package adds support for device memory management implemented in MTIA.é    )ÚAnyNé   )ÚDeviceÚis_initialized)Ú_get_device_indexÚdeviceÚreturnc                 ór   • [        5       (       d  0 $ [        R                  R                  [	        U SS95      $ )a  Return a dictionary of MTIA memory allocator statistics for a given device.

Args:
    device (torch.device, str, or int, optional) selected device. Returns
        statistics for the current device, given by current_device(),
        if device is None (default).
T©Úoptional)r   ÚtorchÚ_CÚ_mtia_memoryStatsr   ©r   s    ÚN/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/mtia/memory.pyÚmemory_statsr      s/   € ô ×ÑØˆ	Ü�8‰8×%Ñ%Ô&7¸ÈÑ&NÓOÐOó    c                 óx   • [        5       (       d  g[        U 5      R                  SS5      R                  SS5      $ )zýReturn the maximum memory allocated in bytes for a given device.

Args:
    device (torch.device, str, or int, optional) selected device. Returns
        statistics for the current device, given by current_device(),
        if device is None (default).
r   ÚdramÚ
peak_bytes©r   r   Úgetr   s    r   Úmax_memory_allocatedr      s5   € ô ×ÑØÜ˜Ó×#Ñ# F¨AÓ.×2Ñ2°<ÀÓCÐCr   c                 óx   • [        5       (       d  g[        U 5      R                  SS5      R                  SS5      $ )a+  Return the current MTIA memory occupied by tensors in bytes for a given device.

Args:
    device (torch.device or int or str, optional): selected device. Returns
        statistic for the current device, given by :func:`~torch.mtia.current_device`,
        if :attr:`device` is ``None`` (default).
r   r   Úallocated_bytesr   r   s    r   Úmemory_allocatedr   '   s6   € ô ×ÑØÜ˜Ó×#Ñ# F¨AÓ.×2Ñ2Ð3DÀaÓHÐHr   c                 ór   • [        5       (       d  g[        R                  R                  [	        U SS95        g)zíReset the peak memory stats for a given device.


Args:
    device (torch.device, str, or int, optional) selected device. Returns
        statistics for the current device, given by current_device(),
        if device is None (default).
NTr   )r   r   r   Ú_mtia_resetPeakMemoryStatsr   r   s    r   Úreset_peak_memory_statsr   4   s*   € ô ×ÑØÜ	‡H�H×'Ñ'Ô(9¸&È4Ñ(PÕQr   )r   r   r   r   )N)Ú__doc__Útypingr   r   Ú r   r   Ú_utilsr   ÚdictÚstrr   Úintr   r   r   Ú__all__© r   r   Ú<module>r)      s~   ðñ Så ã ç $Ý %ñ
P˜ð 
P¨4°°S°©>õ 
Pñ
D ð 
D°3õ 
Dñ
I˜Vð 
I¨sõ 
IñR Fð R°dõ Rò�r   