Skip to content

Commit

Permalink
Fix logistic regression example
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeyeager committed Jan 18, 2017
1 parent 182f862 commit cad2233
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions logreg/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def get_batch(batch_size=32):

# Reset gradients
for param in fc.parameters():
param.grad.zero_()
param.grad.data.zero_()

# Forward pass
output = l1(fc(batch_x), batch_y)
Expand All @@ -65,7 +65,7 @@ def get_batch(batch_size=32):

# Apply gradients
for param in fc.parameters():
param.data.add_(-1 * param.grad)
param.data.add_(-1 * param.grad.data)

# Stop criterion
if loss < 0.1:
Expand Down

0 comments on commit cad2233

Please sign in to comment.