d477e70d888d8501cc0834c47f399a4f65a439d9,senteval/tools/relatedness.py,RelatednessPytorch,predict_proba,#RelatednessPytorch#,124
Before Change
def predict_proba(self, devX):
self.model.eval()
probas = []
for i in range(0, len(devX), self.batch_size):
Xbatch = Variable(devX[i:i + self.batch_size], volatile=True)
if len(probas) == 0:
probas = self.model(Xbatch).data.cpu().numpy()
else:
probas = np.concatenate((probas,
self.model(Xbatch).data.cpu().numpy()), axis=0)
return probas
After Change
def predict_proba(self, devX):
self.model.eval()
probas = []
with torch.no_grad():
for i in range(0, len(devX), self.batch_size):
Xbatch = devX[i:i + self.batch_size]
if len(probas) == 0:
probas = self.model(Xbatch).data.cpu().numpy()
else:
probas = np.concatenate((probas,
self.model(Xbatch).data.cpu().numpy()), axis=0)
return probas
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 7
Instances
Project Name: facebookresearch/SentEval
Commit Name: d477e70d888d8501cc0834c47f399a4f65a439d9
Time: 2018-07-13
Author: asabran@fb.com
File Name: senteval/tools/relatedness.py
Class Name: RelatednessPytorch
Method Name: predict_proba
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
Project Name: silvandeleemput/memcnn
Commit Name: 9c7e9288e31c947aa54aec1217fedfbce2f85bc6
Time: 2019-05-27
Author: silvandeleemput@gmail.com
File Name: memcnn/trainers/classification.py
Class Name:
Method Name: validate
Project Name: keon/seq2seq
Commit Name: 2321f8789713a086978f6e37d088bd00aa60e5f0
Time: 2020-03-07
Author: amitmoryossef@gmail.com
File Name: train.py
Class Name:
Method Name: evaluate