why can’t you use the iter  method I mentioned above?



 Ranahanocka:

You should build a “network” F which does the linear operations you suggest. Then
x = Variable (x0)
optimizer = Adam([x], lr=args.lr)
optimizer.zero_grad()
y_est = F.forward(x)
loss = criterion (y_est, y)
loss.backward()
optimizer.step()