Skip to content

Commit

Permalink
Merge pull request #2 from MatthewKleinsmith/py3_gen_compatibility
Browse files Browse the repository at this point in the history
Replace .next() with next() for py3 compatibility
  • Loading branch information
vinhkhuc authored Apr 8, 2017
2 parents f32192e + 0952204 commit d612f81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion 1_linear_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def main():
cost += train(model, loss, optimizer, X[start:end], Y[start:end])
print("Epoch = %d, cost = %s" % (i + 1, cost / num_batches))

w = model.parameters().next().data # model has only one parameter
w = next(model.parameters()).data # model has only one parameter
print("w = %.2f" % w.numpy()) # will be approximately 2

if __name__ == "__main__":
Expand Down

0 comments on commit d612f81

Please sign in to comment.