数据处理
1 | import torch |
1 | training_data = datasets.FashionMNIST( |
1 | batch_size = 64 |
搭建模型
1 | device = ( |
调整模型
1 | loss_fn = nn.CrossEntropyLoss() |
1 | def train(dataloader, model, loss_fn, optimizer): |
1 | def test(dataloader, model, loss_fn): |
1 | epochs = 5 |
1 | import torch |
1 | training_data = datasets.FashionMNIST( |
1 | batch_size = 64 |
1 | device = ( |
1 | loss_fn = nn.CrossEntropyLoss() |
1 | def train(dataloader, model, loss_fn, optimizer): |
1 | def test(dataloader, model, loss_fn): |
1 | epochs = 5 |