4分钟
导入和参数
In [1]:
%matplotlib inline导入PyTorch模块和定义参数。
In [2]:
import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
# Parameters and DataLoaders
input_size = 5
output_size = 2
batch_size = 30
data_size = 100Device
In [3]:
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
学员评价