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

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)
主站蜘蛛池模板: 宁远县| 河源市| 竹溪县| 阿合奇县| 深水埗区| 石林| 道孚县| 洪雅县| 高安市| 洞头县| 芮城县| 曲麻莱县| 应城市| 五寨县| 泸水县| 蓬溪县| 广宗县| 潮安县| 南京市| 文山县| 德清县| 尉氏县| 邯郸县| 定南县| 吉隆县| 张北县| 荣昌县| 固阳县| 普宁市| 广宗县| 嘉定区| 理塘县| 专栏| 万全县| 莒南县| 聂荣县| 会宁县| 南涧| 视频| 镇坪县| 宜川县|