Abdullah-Nazhat commited on
Commit
9eedbba
·
verified ·
1 Parent(s): e7c8685

Update train.py

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