torch多GPU运行的代码示例

可以参考PyTorch官方文档给出的多GPU示例,例如下面的代码:import torch#CUDA device 0 device = torch.device("cuda:0")#Create two random tensors x = torch.randn(3,3).to(device) y = torch.randn(3,3).to(device)#Multiply two random tensors z = x * y#Print the result print(z)

猜你喜欢

转载自blog.csdn.net/weixin_35748962/article/details/129512656