+
    &j                         R t ^ RIHt ^ RIt^RIHtHt ^RIHt RR R llt	RR R llt
RR	 R
 lltRR R llt. ROtR# )zKThis package adds support for device memory management implemented in MTIA.)AnyN)Deviceis_initialized)_get_device_indexc                R    V ^8  d   QhR\         R\        \        \        3,          /#    devicereturn)r   dictstrr   )formats   "i/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/torch/mtia/memory.py__annotate__r      s&     
P 
P 
P4S> 
P    c                z    \        4       '       g   / # \        P                  P                  \	        V RR7      4      # )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   &r   memory_statsr      s/     	88%%&7&NOOr   c                0    V ^8  d   QhR\         R\        /# r   r   int)r   s   "r   r   r      s     
D 
D 
D3 
Dr   c                |    \        4       '       g   ^ # \        V 4      P                  R^ 4      P                  R^ 4      # )zReturn 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).
dram
peak_bytesr   r   getr   s   &r   max_memory_allocatedr!      s5     ##FA.22<CCr   c                0    V ^8  d   QhR\         R\        /# r   r   )r   s   "r   r   r   '   s     
I 
IV 
Is 
Ir   c                |    \        4       '       g   ^ # \        V 4      P                  R^ 4      P                  R^ 4      # )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   allocated_bytesr   r   s   &r   memory_allocatedr%   '   s6     ##FA.223DaHHr   c                (    V ^8  d   QhR\         RR/# )r   r	   r
   N)r   )r   s   "r   r   r   4   s     R RF Rd Rr   c                ~    \        4       '       g   R# \        P                  P                  \	        V RR7      4       R# )zReset 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*     	HH''(9&4(PQr   )N)r   r!   r%   r)   )__doc__typingr   r    r   r   _utilsr   r   r!   r%   r)   __all__ r   r   <module>r0      s6    S   $ %
P
D
IRr   