[docs]defis_built()->bool:r"""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. """returntorch._C._has_mps
[docs]@_lru_cachedefis_available()->bool:r"""Return a bool indicating if MPS is currently available."""returntorch._C._mps_is_available()
@_lru_cachedefis_macos_or_newer(major:int,minor:int)->bool:r"""Return a bool indicating whether MPS is running on given MacOS or newer."""returntorch._C._mps_is_on_macos_or_newer(major,minor)@_lru_cachedefis_macos13_or_newer(minor:int=0)->bool:r"""Return a bool indicating whether MPS is running on MacOS 13 or newer."""returntorch._C._mps_is_on_macos_or_newer(13,minor)_lib:Optional[_Library]=Nonedef_init():r"""Register prims as implementation of var_mean and group_norm."""global_libif_libisnotNoneornotis_built():returnfromtorch._decomp.decompositionsimportnative_group_norm_backwardfromtorch._refsimportnative_group_norm_lib=_Library("aten","IMPL")# noqa: TOR901_lib.impl("native_group_norm",native_group_norm,"MPS")_lib.impl("native_group_norm_backward",native_group_norm_backward,"MPS")
Docs
Access comprehensive developer documentation for PyTorch
To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.