Abdullah-Nazhat commited on
Commit
90e16cd
·
verified ·
1 Parent(s): 1c532b3

Update train.py

Browse files
Files changed (1) hide show
  1. train.py +2 -2
train.py CHANGED
@@ -101,7 +101,7 @@ def train(dataloader, model, loss_fn, optimizer):
101
 
102
  train_loss /= num_batches
103
  train_accuracy = 100. * correct.item() / size
104
- print(train_accuracy)
105
  return train_loss,train_accuracy
106
 
107
  def test(dataloader, model, loss_fn):
@@ -118,7 +118,7 @@ def test(dataloader, model, loss_fn):
118
  correct += (pred.argmax(1) == y).type(torch.float).sum().item()
119
  test_loss /= num_batches
120
  correct /= size
121
- print(f"Test Error: \n Accuracy: {(100*correct):>0.1f}%, Avg loss: {test_loss:>8f} \n")
122
  test_accuracy = 100*correct
123
  return test_loss, test_accuracy
124
 
 
101
 
102
  train_loss /= num_batches
103
  train_accuracy = 100. * correct.item() / size
104
+ print(f"Train Metric: \n Accuracy: {(100*correct):>0.1f}% \n")
105
  return train_loss,train_accuracy
106
 
107
  def test(dataloader, model, loss_fn):
 
118
  correct += (pred.argmax(1) == y).type(torch.float).sum().item()
119
  test_loss /= num_batches
120
  correct /= size
121
+ print(f"Test Metrics: \n Accuracy: {(100*correct):>0.1f}%, Avg loss: {test_loss:>8f} \n")
122
  test_accuracy = 100*correct
123
  return test_loss, test_accuracy
124