batch may not have the copy method
🐛 Bug
In this commit: 48b797f
The training batch is copied before transfer_batch_to_gpu , but a batch may not have the copy method. Thus, the following error will be raised in some cases (e.g., the batch is a tuple ):
Traceback (most recent call last):
  File "scripts/msmacro.py", line 113, in <module>
    main()
  File "scripts/msmacro.py", line 109, in main
    trainer.fit(model)
  File "/home/zhaohao/Documents/pytorch-lightning/pytorch_lightning/trainer/trainer.py", line 405, in fit
    self.single_gpu_train(model)
  File "/home/zhaohao/Documents/pytorch-lightning/pytorch_lightning/trainer/distrib_parts.py", line 441, in single_gpu_train
    self.run_pretrain_routine(model)
  File "/home/zhaohao/Documents/pytorch-lightning/pytorch_lightning/trainer/trainer.py", line 539, in run_pretrain_routine
    self.train()
  File "/home/zhaohao/Documents/pytorch-lightning/pytorch_lightning/trainer/training_loop.py", line 332, in train
    self.run_training_epoch()
  File "/home/zhaohao/Documents/pytorch-lightning/pytorch_lightning/trainer/training_loop.py", line 385, in run_training_epoch
    output = self.run_training_batch(batch, batch_idx)
  File "/home/zhaohao/Documents/pytorch-lightning/pytorch_lightning/trainer/training_loop.py", line 504, in run_training_batch
    loss = optimizer_closure()
  File "/home/zhaohao/Documents/pytorch-lightning/pytorch_lightning/trainer/training_loop.py", line 473, in optimizer_closure
    split_batch, batch_idx, opt_idx, self.hiddens)
  File "/home/zhaohao/Documents/pytorch-lightning/pytorch_lightning/trainer/training_loop.py", line 589, in training_forward
    batch = self.transfer_batch_to_gpu(batch.copy(), gpu_id)
AttributeError: 'tuple' object has no attribute 'copy'