o
    ‡ZŽhj  ã                   @   s¨   U d dl mZ d dlmZmZ d dlZd dlmZ	 g d¢Z
defdd„Zedefd	d
„ƒZedededefdd„ƒZeddedefdd„ƒZdaee	 ed< dd„ ZdS )é    )Ú	lru_cache)ÚOptionalÚTYPE_CHECKINGN)ÚLibrary)Úis_builtÚis_availableÚis_macos13_or_newerÚis_macos_or_newerÚreturnc                   C   s   t jjS )zóReturn whether PyTorch is built with MPS support.

    Note that this doesn't necessarily mean MPS is available; just that
    if this PyTorch binary were run a machine with working MPS drivers
    and devices, we would be able to use it.
    )ÚtorchÚ_CZ_has_mps© r   r   úJ/var/www/auris/lib/python3.10/site-packages/torch/backends/mps/__init__.pyr      s   r   c                   C   s
   t j ¡ S )z7Return a bool indicating if MPS is currently available.)r   r   Z_mps_is_availabler   r   r   r   r      s   
r   ÚmajorÚminorc                 C   s   t j | |¡S )zHReturn a bool indicating whether MPS is running on given MacOS or newer.©r   r   Z_mps_is_on_macos_or_newer)r   r   r   r   r   r	      ó   r	   c                 C   s   t j d| ¡S )zEReturn a bool indicating whether MPS is running on MacOS 13 or newer.é   r   )r   r   r   r   r   "   r   r   Ú_libc                  C   sT   t dustƒ s	dS ddlm}  ddlm} tddƒa t  d|d¡ t  d	| d¡ dS )
z<Register prims as implementation of var_mean and group_norm.Nr   )Únative_group_norm_backward)Únative_group_normZatenZIMPLr   ZMPSr   )r   r   Ztorch._decomp.decompositionsr   Ztorch._refsr   Ú_LibraryÚimpl)r   r   r   r   r   Ú_init+   s   
r   )r   )Ú	functoolsr   Z
_lru_cacheÚtypingr   r   r   Ztorch.libraryr   r   Ú__all__Úboolr   r   Úintr	   r   r   Ú__annotations__r   r   r   r   r   Ú<module>   s   
