当前位置:   article > 正文

Mac GPU MPS常用方法_使用mps加速计算是否需要安装xcode

使用mps加速计算是否需要安装xcode

Requirements

Mac computers with Apple silicon or AMD GPUs
macOS 12.3 or later
Python 3.7 or later
Xcode command-line tools: xcode-select --install

判断是否可用

import torch
if torch.backends.mps.is_available():
    mps_device = torch.device("mps")
    x = torch.ones(1, device=mps_device)
    print (x)
else:
    print ("MPS device not found.")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/401474
推荐阅读
相关标签
  

闽ICP备14008679号