Last active
December 18, 2019 07:20
-
-
Save thomwolf/be4c26b1baf05db92b3325f1b1be2798 to your computer and use it in GitHub Desktop.
A simple PyTorch training loop
This file contains 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
predictions = model(inputs) # Forward pass | |
loss = loss_function(predictions, labels) # Compute loss function | |
loss.backward() # Backward pass | |
optimizer.step() # Optimizer step | |
predictions = model(inputs) # Forward pass with new parameters |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment