对于网络模型的实例化对象net
一、
import torch device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") net.to(device)
二、
import torch net.cuda()
对于网络模型的实例化对象net
一、
import torch device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") net.to(device)
二、
import torch net.cuda()
转载于:https://www.cnblogs.com/czz0508/p/10954040.html