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

Before Change


    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)
    print("Average loss: {:.4f}".format(test_loss))

for epoch in range(1, NUM_EPOCHS+1):
    train(epoch)
    test(epoch)

After Change


        output = model(batch_data)
        test_loss += criterion(output, batch_targets)
        pred = output.data.max(1)[1]
        correct += pred.long().eq(batch_targets.data.long()).sum()

    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)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


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


Project Name: dmlc/dgl
Commit Name: 562871e76b2d5adbcd907bcf62ca28c0611e50e1
Time: 2020-07-22
Author: zhengda1936@gmail.com
File Name: examples/pytorch/graphsage/experimental/train_dist.py
Class Name:
Method Name: run