L1aoXingyu / pytorch-beginner

pytorch tutorial for beginners
3k stars 1.09k forks source link

Zero accuracy in 02 logistic regression #15

Open icemiliang opened 6 years ago

icemiliang commented 6 years ago

In 02 Logistic Regression, all accuracies are zero. Need to convert torch tensor to float.

line 68: running_acc += num_correct.data[0] --> running_acc += num_correct.data[0].float() line 98: eval_acc += num_correct.data[0] --> eval_acc += num_correct.data[0].float()