Gotcha. It all makes sense now. Thanks!
Follow up question, now that I’ve been thinking about the optimizers:
CODE:

def helper(x):
return 2 * x[0] + 3 * x[1]**2
x = autograd.Variable(torch.FloatTensor([1, 2]), requires_grad=True)
optimizer = optim.SGD(x, lr = 0.1)
for i in range(3): # number of epochs
optimizer.zero_grad()
print("iteration: " + str(i))
total = autograd.Variable(torch.FloatTensor([0]))
total += helper(x)
total.backward()
optimizer.step()
print(x[0], x[1])

OUTPUT:
Error at: optimizer = optim.SGD(x, lr = 0.1)
TypeError: params argument given to the optimizer should be an iterable of Variables or dicts, but got torch.autograd.variable.Variable

I’m guessing PyTorch wants the input to optim.SGD as a list of Variables, huh? I suppose my question would be: should I refactor my code to accommodate this, or is there a better best practice?