fbec92e2363493126b4927a167039fbd037f17bc,code/deep/DAN/DAN.py,,test,#,90

Before Change


            data, target = data.cuda(), target.cuda()
        data, target = Variable(data, volatile=True), Variable(target)
        s_output, t_output = model(data, data)
        test_loss += F.nll_loss(F.log_softmax(s_output, dim = 1), target, size_average=False).data[0] // sum up batch loss
        pred = s_output.data.max(1)[1] // get the index of the max log-probability
        correct += pred.eq(target.data.view_as(pred)).cpu().sum()

After Change


        for tgt_test_data, tgt_test_label in tgt_test_loader:
            if cuda:
                tgt_test_data, tgt_test_label = tgt_test_data.cuda(), tgt_test_label.cuda()
            tgt_test_data, tgt_test_label = Variable(tgt_test_data), Variable(tgt_test_label)
            tgt_pred, mmd_loss = model(tgt_test_data, tgt_test_data)
            test_loss += F.nll_loss(F.log_softmax(tgt_pred, dim = 1), tgt_test_label, reduction="sum").item() // sum up batch loss
            pred = tgt_pred.data.max(1)[1] // get the index of the max log-probability
            correct += pred.eq(tgt_test_label.data.view_as(pred)).cpu().sum()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: jindongwang/transferlearning
Commit Name: fbec92e2363493126b4927a167039fbd037f17bc
Time: 2019-10-21
Author: 1299192934@qq.com
File Name: code/deep/DAN/DAN.py
Class Name:
Method Name: test


Project Name: jindongwang/transferlearning
Commit Name: fbec92e2363493126b4927a167039fbd037f17bc
Time: 2019-10-21
Author: 1299192934@qq.com
File Name: code/deep/DAN/DAN.py
Class Name:
Method Name: test


Project Name: jadore801120/attention-is-all-you-need-pytorch
Commit Name: 15b19130a9162feb9153a2f38c5c8b0af02c6a1d
Time: 2018-08-21
Author: yhhuang@nlg.csie.ntu.edu.tw
File Name: train.py
Class Name:
Method Name: train_epoch


Project Name: jadore801120/attention-is-all-you-need-pytorch
Commit Name: 15b19130a9162feb9153a2f38c5c8b0af02c6a1d
Time: 2018-08-21
Author: yhhuang@nlg.csie.ntu.edu.tw
File Name: train.py
Class Name:
Method Name: eval_epoch