Last active
May 3, 2019 09:54
-
-
Save dvgodoy/1551eb27a7c5f94df8534a1566219837 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| losses = [] | |
| train_step = make_train_step(model, loss_fn, optimizer) | |
| for epoch in range(n_epochs): | |
| for x_batch, y_batch in train_loader: | |
| # the dataset "lives" in the CPU, so do our mini-batches | |
| # therefore, we need to send those mini-batches to the | |
| # device where the model "lives" | |
| x_batch = x_batch.to(device) | |
| y_batch = y_batch.to(device) | |
| loss = train_step(x_batch, y_batch) | |
| losses.append(loss) | |
| print(model.state_dict()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment