Recursive device conversion of tuple
This bug report related to #116 and #154.
Describe the bug
When passing a batch such as:
batch = ([tensor, tensor], [{'a': tensor, 'b': tensor}, {'a': tensor, 'b': tensor}])
transfer_batch_to_gpu raises the error: TypeError: 'tuple' object does not support item assignment.
I found that above error caused by concatenation of two conditions: isinstance(batch, list) or isinstance(batch, tuple).
https://github.com/williamFalcon/pytorch-lightning/blob/55a804b7cfb9b2376ccaa1253a966dcaa9b6ab07/pytorch_lightning/models/trainer.py#L925-L928
Expected behavior
A batch
batch = ([tensor, tensor], [{'a': tensor, 'b': tensor}, {'a': tensor, 'b': tensor}])
should be
batch = ([cuda_tensor, cuda_tensor], [{'a': cuda_tensor, 'b': cuda_tensor}, {'a': cuda_tensor, 'b': cuda_tensor}])
Additional context
I already fixed the bug and will submit PR soon.