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

Before Change


    batch_data_t = torch.FloatTensor(BATCH_SIZE, 1, 28, 28)
    batch_targets_t = torch.LongTensor(BATCH_SIZE)
    if cuda:
        batch_data_t = batch_data_t.cuda()
        batch_targets_t = batch_targets_t.cuda()
    batch_data = Variable(batch_data_t, requires_grad=False)
    batch_targets = Variable(batch_targets_t, requires_grad=False)
    for i in range(0, training_data.size(0), BATCH_SIZE):
        optimizer.zero_grad()
        batch_data.data[:] = training_data[i:i+BATCH_SIZE]

After Change


    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()
        batch_data.data[:] = training_data[start:end]
        batch_targets.data[:] = training_labels[start:end]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

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: maciejkula/spotlight
Commit Name: aa1eb21d82804500e2357cde21b18bcf6f87825a
Time: 2017-08-02
Author: maciej.kula@gmail.com
File Name: spotlight/factorization/explicit.py
Class Name: ExplicitFactorizationModel
Method Name: predict


Project Name: maciejkula/spotlight
Commit Name: aa1eb21d82804500e2357cde21b18bcf6f87825a
Time: 2017-08-02
Author: maciej.kula@gmail.com
File Name: spotlight/factorization/implicit.py
Class Name: ImplicitFactorizationModel
Method Name: predict


Project Name: asyml/texar
Commit Name: f1b7e12c77298fdce190e7270af61c1a734fc8e1
Time: 2018-03-30
Author: zhitinghu@gmail.com
File Name: texar/core/optimization.py
Class Name:
Method Name: get_train_op