From 0288e99ef042bf6e66fc2f850e46b33461d0b9d4 Mon Sep 17 00:00:00 2001 From: Tullie Murrell Date: Mon, 18 Nov 2019 11:38:13 -0800 Subject: [PATCH] Copy batch for local forward --- pytorch_lightning/trainer/train_loop_mixin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch_lightning/trainer/train_loop_mixin.py b/pytorch_lightning/trainer/train_loop_mixin.py index 7e9fde01485e3..6130fd4931342 100644 --- a/pytorch_lightning/trainer/train_loop_mixin.py +++ b/pytorch_lightning/trainer/train_loop_mixin.py @@ -290,7 +290,7 @@ def training_forward(self, batch, batch_nb, opt_idx, hiddens): 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)