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

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)
主站蜘蛛池模板: 昭苏县| 烟台市| 南开区| 镇康县| 和田县| 通州区| 基隆市| 遵化市| 施秉县| 宁津县| 龙海市| 阿克苏市| 长春市| 峨眉山市| 龙里县| 东方市| 云和县| 中宁县| 犍为县| 缙云县| 沐川县| 怀安县| 德钦县| 曲阜市| 屯门区| 民和| 界首市| 舒城县| 永州市| 冕宁县| 铜川市| 洞头县| 开封县| 吴川市| 临夏市| 繁昌县| 凭祥市| 眉山市| 梅州市| 商河县| 扶沟县|