Ë
    3êñi¹  ã                   ó’   — d Z ddlmZ ddlZddlmZmZ ddlmZ ddede	e
ef   fd	„Zddedefd
„Zddedefd„Zddeddfd„Zg d¢Zy)zKThis package adds support for device memory management implemented in MTIA.é    )ÚAnyNé   )ÚDeviceÚis_initialized)Ú_get_device_indexÚdeviceÚreturnc                 ón   — t        «       si S t        j                  j                  t	        | d¬«      «      S )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    úS/var/www/pod-logistic/pod-ai/venv/lib/python3.12/site-packages/torch/mtia/memory.pyÚmemory_statsr      s,   € ô ÔØˆ	Ü�8‰8×%Ñ%Ô&7¸ÈÔ&NÓOÐOó    c                 ón   — t        «       syt        | «      j                  dd«      j                  dd«      S )a  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      s2   € ô ÔØÜ˜Ó×#Ñ# F¨AÓ.×2Ñ2°<ÀÓCÐCr   c                 ón   — t        «       syt        | «      j                  dd«      j                  dd«      S )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   '   s3   € ô ÔØÜ˜Ó×#Ñ# F¨AÓ.×2Ñ2Ð3DÀaÓHÐHr   c                 ón   — t        «       syt        j                  j                  t	        | d¬«      «       y)a  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   