77a6ec73c53c5cc62a2ae451694537144afa5644,mnist/main.py,,test,#Any#,74

Before Change


        print("Testing model: {}/{}".format(i, test_data.size(0)), end="\r")
        batch_data.data[:] = test_data[i:i+TEST_BATCH_SIZE]
        batch_targets.data[:] = test_labels[i:i+TEST_BATCH_SIZE]
        test_loss += criterion(model(batch_data), batch_targets)

    test_loss = test_loss.data[0]
    test_loss /= (test_data.size(0) / TEST_BATCH_SIZE) // criterion averages over batch size
    print("TEST SET RESULTS:" + " " * 20)

After Change


    print("TEST SET RESULTS:" + " " * 20)
    print("Average loss: {:.4f}, Accuracy: {}/{} ({:.0f}%)".format(
        test_loss, correct, test_data.size(0),
        float(correct)/test_data.size(0)*100))

for epoch in range(1, NUM_EPOCHS+1):
    train(epoch)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: pytorch/examples
Commit Name: 77a6ec73c53c5cc62a2ae451694537144afa5644
Time: 2016-09-14
Author: alerer@fb.com
File Name: mnist/main.py
Class Name:
Method Name: test


Project Name: pytorch/examples
Commit Name: 031392ff2cbb5703558d17a676a456521f754190
Time: 2016-12-15
Author: soumith@fb.com
File Name: mnist/main.py
Class Name:
Method Name: train