
    #h                         d Z ddlmZ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gZy)zKThis package adds support for device memory management implemented in MTIA.    )AnyDictOptionalN   )	_device_t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    N/var/www/html/sandstorm/venv/lib/python3.12/site-packages/torch/mtia/memory.pymemory_statsr      s,     	88%%&7&NOO    c                 :    t        |       j                  dd      S )a)  Return the maximum memory allocated in bytes for a given device.

    Args:
        device (torch.device or int, optional): selected device. Returns
            statistic for the current device, given by :func:`~torch.mtia.current_device`,
            if :attr:`device` is ``None`` (default).
    r   zallocated_bytes.all.peakr   )r   getr   s    r   max_memory_allocatedr      s     v&**+EqIIr   r   r   )N)__doc__typingr   r   r   r    r   r   _utilsr	   strr   intr   __all__ r   r   <module>r       sg    S & &  ' %
P), 
PS#X 
P	J)!4 	J 	J r   