031392ff2cbb5703558d17a676a456521f754190,mnist/main.py,,train,#Any#,67

Before Change


        loss = loss.data[0]
        optimizer.step()
        print("Epoch: {} [{}/{} ({:.0f}%)]\tLoss: {:.4f}".format(epoch,
            i+BATCH_SIZE, training_data.size(0),
            float(i+BATCH_SIZE)/training_data.size(0)*100, loss))

def test(epoch):
    test_loss = 0

After Change


        batch_data, batch_targets = batch_data.cuda(), batch_targets.cuda()

    // create autograd Variables over these buffers
    batch_data, batch_targets = Variable(batch_data), Variable(batch_targets)

    for i in range(0, training_data.size(0)-opt.batchSize+1, opt.batchSize):
        start, end = i, i+opt.batchSize
        optimizer.zero_grad()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 6

Instances


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


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


Project Name: pytorch/examples
Commit Name: b87368e1e7fd832b505db9cc08015ac7af8f95de
Time: 2016-12-23
Author: jvanamersfoort@twitter.com
File Name: VAE/main.py
Class Name:
Method Name: train