Solved by richard in post #2 
              
              
                Do you want to learn about why SGD works, or just how to use it? 
I attempted to make a minimal example of SGD. I hope this helps! 
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable

# Let's make some data for a linear regression.
A = 3.1415926
b = 2.…