pytorch调用cuda
时间: 2023-04-02 14:01:59 浏览: 161
modulated-deform-conv:变形卷积2D 3D DeformableConvolution DeformConv调制火炬CUDA
可以使用以下代码将 PyTorch 调用 CUDA:
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
x = torch.randn(10, 10).to(device)
y = torch.randn(10, 10).to(device)
z = torch.matmul(x, y)
print(z)
阅读全文