b87368e1e7fd832b505db9cc08015ac7af8f95de,VAE/main.py,,test,#Any#,115

Before Change


    if cuda:
        batch_data_t = batch_data_t.cuda()
    batch_data = Variable(batch_data_t, volatile=True)
    for i in range(0, test_data.size(0), TEST_BATCH_SIZE):
        print("Testing model: {}/{}".format(i, test_data.size(0)), end="\r")
        batch_data.data[:] = test_data[i:i + TEST_BATCH_SIZE]
        recon_batch_data, mu, logvar = model(batch_data)
        test_loss += loss_function(recon_batch_data, batch_data, mu, logvar)

    test_loss = test_loss.data[0] / test_data.size(0)
    print("TEST SET RESULTS:" + " " * 20)
    print("Average loss: {:.4f}".format(test_loss))

After Change


    model.eval()
    test_loss = 0
    for batch in test_loader:
        batch = Variable(batch)

        recon_batch, mu, logvar = model(batch)
        test_loss += loss_function(recon_batch, batch, mu, logvar)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


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


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


Project Name: NifTK/NiftyNet
Commit Name: a4b1242ba2567d02950e0a106d0fa4d6707389d8
Time: 2017-08-11
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/application/gan_application.py
Class Name: GANApplication
Method Name: connect_data_and_network