§
    Ó˜ºhÝ  ã                   ó°   — d Z ddlmZmZ ddlZddlmZmZ ddlm	Z	 ddee         de
eef         fd	„Zddee         defd
„Zddee         ddfd„Zg d¢ZdS )zKThis package adds support for device memory management implemented in MTIA.é    )ÚAnyÚOptionalNé   )Ú	_device_tÚis_initialized)Ú_get_device_indexÚdeviceÚreturnc                 ó~   — t          ¦   «         si S t          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    úY/var/www/html/services/rag-service/venv/lib/python3.11/site-packages/torch/mtia/memory.pyÚmemory_statsr      s;   € õ ÑÔð Øˆ	ÝŒ8×%Ò%Õ&7¸ÈÐ&NÑ&NÔ&NÑOÔOÐOó    c                 ó�   — t          ¦   «         sdS t          | ¦  «                             dd¦  «                             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      sE   € õ ÑÔð ØˆqÝ˜ÑÔ×#Ò# F¨AÑ.Ô.×2Ò2°<ÀÑCÔCÐCr   c                 ó‚   — t          ¦   «         sdS t          j                             t	          | d¬¦  «        ¦  «         dS )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   '   sA   € õ ÑÔð ØˆÝ	„H×'Ò'Õ(9¸&È4Ð(PÑ(PÔ(PÑQÔQÐQÐQÐQr   )r   r   r   )N)Ú__doc__Útypingr   r   r   Ú r   r   Ú_utilsr   ÚdictÚstrr   Úintr   r   Ú__all__© r   r   ú<module>r&      s  ðð SÐ Rà  Ð  Ð  Ð  Ð  Ð  Ð  Ð  à €€€à 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø %Ð %Ð %Ð %Ð %Ð %ð
Pð 
P˜ )Ô,ð 
P¸¸SÀ#¸X¼ð 
Pð 
Pð 
Pð 
Pð
Dð 
D ¨)Ô!4ð 
DÀð 
Dð 
Dð 
Dð 
DðRð R H¨YÔ$7ð RÀ4ð Rð Rð Rð Rðð ð €€€r   