官术网_书友最值得收藏!

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)
主站蜘蛛池模板: 同仁县| 九台市| 英吉沙县| 双牌县| 北安市| 水富县| 吉木乃县| 洪湖市| 孟州市| 尤溪县| 崇州市| 舒城县| 阿克| 金山区| 保山市| 达州市| 化隆| 清苑县| 冕宁县| 金堂县| 宜城市| 时尚| 乃东县| 涿鹿县| 太康县| 鄂尔多斯市| 江西省| 焉耆| 唐山市| 东台市| 离岛区| 赞皇县| 法库县| 宜都市| 大宁县| 河津市| 彭州市| 阿拉善右旗| 天全县| 美姑县| 资中县|