Copy batch for local forward (#532)

This commit is contained in:
Tullie Murrell 2019-11-23 01:04:40 -08:00 committed by William Falcon
parent 55edf7c922
commit 48b797fdb0
1 changed files with 1 additions and 1 deletions

View File

@ -290,7 +290,7 @@ class TrainerTrainLoopMixin(object):
gpu_id = 0
if type(self.data_parallel_device_ids) is list:
gpu_id = self.data_parallel_device_ids[0]
batch = self.transfer_batch_to_gpu(batch, gpu_id)
batch = self.transfer_batch_to_gpu(batch.copy(), gpu_id)
args[0] = batch
output = self.model.training_step(*args)