
    sgj                         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Zedefd       Zed	ed
edefd       Zedd
edefd       Zdaee	   ed<   d Zy)    )	lru_cache)OptionalTYPE_CHECKINGN)Library)is_builtis_availableis_macos13_or_neweris_macos_or_newerreturnc                  6    t         j                  j                  S )zReturn 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_C_has_mps     N/var/www/html/venv/lib/python3.12/site-packages/torch/backends/mps/__init__.pyr   r      s     88r   c                  >    t         j                  j                         S )z7Return a bool indicating if MPS is currently available.)r   r   _mps_is_availabler   r   r   r   r      s     88%%''r   majorminorc                 B    t         j                  j                  | |      S )zHReturn a bool indicating whether MPS is running on given MacOS or newer.r   r   _mps_is_on_macos_or_newer)r   r   s     r   r
   r
      s     88--eU;;r   c                 B    t         j                  j                  d|       S )zEReturn a bool indicating whether MPS is running on MacOS 13 or newer.   r   )r   s    r   r	   r	   "   s     88--b%88r   _libc                      t         
t               syddlm}  ddlm} t        dd      a t         j                  d|d       t         j                  d	| d       y)
z<Register prims as implementation of var_mean and group_norm.Nr   )native_group_norm_backward)native_group_normatenIMPLr   MPSr   )r   r   torch._decomp.decompositionsr   torch._refsr   _Libraryimpl)r   r   s     r   _initr'   +   sG     xzG-FF#DII!#4e<II*,FNr   )r   )	functoolsr   
_lru_cachetypingr   r   r   torch.libraryr   r%   __all__boolr   r   intr
   r	   r   __annotations__r'   r   r   r   <module>r0      s    - *  - S$  (d ( (
 <S < < < <
 9s 94 9 9
  hx Or   