From 48b797fdb046bab73fc04ef6d6780f05d3623485 Mon Sep 17 00:00:00 2001 From: Tullie Murrell Date: Sat, 23 Nov 2019 01:04:40 -0800 Subject: [PATCH] Copy batch for local forward (#532) --- 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)