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

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)
主站蜘蛛池模板: 上栗县| 酉阳| 陇西县| 临湘市| 章丘市| 抚远县| 察隅县| 崇义县| 鄂托克前旗| 龙岩市| 巴里| 繁昌县| 乌拉特前旗| 周口市| 金秀| 南阳市| 当涂县| 永川市| 隆林| 和平区| 虎林市| 临沂市| 凭祥市| 岐山县| 娄烦县| 高阳县| 宁武县| 柞水县| 新源县| 陵川县| 伊通| 任丘市| 紫阳县| 蒲城县| 灵川县| 涟源市| 连城县| 抚宁县| 长治市| 庄浪县| 屏山县|