2154d789ef0d79debe2cc522751ae7072e8b22dc,torchsample/modules/super_module.py,SuperModule,predict_loader,#SuperModule#Any#Any#Any#,475

Before Change


                x_batch = x_batch.cuda(cuda_device)
            batch_pred = self(x_batch)
            preds.append(batch_pred.data)
        self.train()
        return Variable(torch.cat(preds))

    def predict_on_batch(self, 
                         x, 

After Change


        prediction_list = []
        for batch_idx, batch_data in enumerate(loader):
            if not isinstance(batch_data, (tuple,list)):
                batch_data = [batch_data]
            input_batch = batch_data[0]
            if not isinstance(input_batch, (list,tuple)):
                input_batch = [input_batch]
            input_batch = [Variable(ins) for ins in input_batch]
            if cuda_device > -1:
                input_batch = [ins.cuda(cuda_device) for ins in input_batch]

            prediction_list.append(self(*input_batch))
        return torch.cat(prediction_list,0)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: ncullen93/torchsample
Commit Name: 2154d789ef0d79debe2cc522751ae7072e8b22dc
Time: 2017-04-28
Author: ncullen@modv-vlan533.0527.apn.wlan.wireless-pennnet.upenn.edu
File Name: torchsample/modules/super_module.py
Class Name: SuperModule
Method Name: predict_loader


Project Name: jindongwang/transferlearning
Commit Name: e6b394f7340cbeee16bf4424cdf0367f80b60619
Time: 2018-12-22
Author: jindongwang@outlook.com
File Name: code/deep/finetune_AlexNet_ResNet/office31.py
Class Name:
Method Name:


Project Name: ncullen93/torchsample
Commit Name: 2154d789ef0d79debe2cc522751ae7072e8b22dc
Time: 2017-04-28
Author: ncullen@modv-vlan533.0527.apn.wlan.wireless-pennnet.upenn.edu
File Name: torchsample/modules/super_module.py
Class Name: SuperModule
Method Name: predict_on_batch