b696ad3275b2b7fb00fcd6b95d11d85f6d813101,nrekit/framework/bag_re.py,BagRE,eval_model,#BagRE#Any#,140

Before Change


            t = tqdm(eval_loader)
            pred_result = []
            for iter, data in enumerate(t):
                label, bag_name, scope, token, pos1, pos2, mask = data
                if torch.cuda.is_available():
                    token = token.cuda()
                    pos1 = pos1.cuda()
                    pos2 = pos2.cuda()
                    label = label.cuda()
                    mask = mask.cuda()
                logits = self.forward(None, scope, token, pos1, pos2, mask, train=False) // results after softmax
                for i in range(logits.size(0)):
                    for relid in range(self.num_class):
                        if self.id2rel[relid] != "NA":

After Change


            pred_result = []
            for iter, data in enumerate(t):
                if torch.cuda.is_available():
                    for i in range(len(data)):
                        try:
                            data[i] = data[i].cuda()
                        except:
                            pass
                label = data[0]
                bag_name = data[1]
                scope = data[2]
                args = data[3:]
                logits = self.model(None, scope, *args, train=False) // results after softmax
                for i in range(logits.size(0)):
                    for relid in range(self.model.num_class):
                        if self.model.id2rel[relid] != "NA":
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 34

Instances


Project Name: thunlp/OpenNRE
Commit Name: b696ad3275b2b7fb00fcd6b95d11d85f6d813101
Time: 2019-06-30
Author: gaotianyu1350@126.com
File Name: nrekit/framework/bag_re.py
Class Name: BagRE
Method Name: eval_model


Project Name: thunlp/OpenNRE
Commit Name: 7c15c881392d8a16ea90b52a71002384255fb385
Time: 2019-11-02
Author: gaotianyu1350@126.com
File Name: nrekit/framework/bag_re.py
Class Name: BagRE
Method Name: eval_model


Project Name: thunlp/OpenNRE
Commit Name: b696ad3275b2b7fb00fcd6b95d11d85f6d813101
Time: 2019-06-30
Author: gaotianyu1350@126.com
File Name: nrekit/framework/bag_re.py
Class Name: BagRE
Method Name: train_model


Project Name: thunlp/OpenNRE
Commit Name: 7c15c881392d8a16ea90b52a71002384255fb385
Time: 2019-11-02
Author: gaotianyu1350@126.com
File Name: nrekit/framework/bag_re.py
Class Name: BagRE
Method Name: train_model


Project Name: thunlp/OpenNRE
Commit Name: b696ad3275b2b7fb00fcd6b95d11d85f6d813101
Time: 2019-06-30
Author: gaotianyu1350@126.com
File Name: nrekit/framework/bag_re.py
Class Name: BagRE
Method Name: eval_model