@@ -76,8 +76,8 @@ class Inference(object): | |||||
iterator = iter(Batchifier(SequentialSampler(data), self.batch_size, drop_last=False)) | iterator = iter(Batchifier(SequentialSampler(data), self.batch_size, drop_last=False)) | ||||
for batch_x in self.make_batch(iterator, data, use_cuda=False): | for batch_x in self.make_batch(iterator, data, use_cuda=False): | ||||
prediction = self.data_forward(network, batch_x) | |||||
with torch.no_grad(): | |||||
prediction = self.data_forward(network, batch_x) | |||||
self.batch_output.append(prediction) | self.batch_output.append(prediction) | ||||
@@ -50,10 +50,9 @@ class BaseTester(object): | |||||
step = 0 | step = 0 | ||||
for batch_x, batch_y in self.make_batch(iterator, dev_data): | for batch_x, batch_y in self.make_batch(iterator, dev_data): | ||||
prediction = self.data_forward(network, batch_x) | |||||
eval_results = self.evaluate(prediction, batch_y) | |||||
with torch.no_grad(): | |||||
prediction = self.data_forward(network, batch_x) | |||||
eval_results = self.evaluate(prediction, batch_y) | |||||
if self.save_output: | if self.save_output: | ||||
self.batch_output.append(prediction) | self.batch_output.append(prediction) | ||||