- Python Deep Learning
- Ivan Vasilev Daniel Slater Gianmario Spacagna Peter Roelants Valentino Zocca
- 103字
- 2021-07-02 14:31:10
PyTorch
PyTorch (https://pytorch.org/) is a deep learning library based on Torch and developed by Facebook. It is relatively easy to use, and has recently gained a lot of popularity. It will automatically select a GPU, if one is available, reverting to the CPU otherwise. If you wish to select the device explicitly, you could use the following code sample:
# at beginning of the script
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
...
# then whenever you get a new Tensor or Module
# this won't copy if they are already on the desired device
input = data.to(device)
model = MyModule(...).to(device)
推薦閱讀
- C++面向對象程序設計(第三版)
- Dynamics 365 for Finance and Operations Development Cookbook(Fourth Edition)
- Raspberry Pi for Python Programmers Cookbook(Second Edition)
- GAE編程指南
- Python編程自學手冊
- 流量的秘密:Google Analytics網站分析與優化技巧(第2版)
- Learning PostgreSQL
- 造個小程序:與微信一起干件正經事兒
- Ext JS Data-driven Application Design
- Python Game Programming By Example
- Git高手之路
- Scratch 3游戲與人工智能編程完全自學教程
- Mastering Yii
- Effective Python Penetration Testing
- Visual FoxPro程序設計