TypeError: expected sequence object with len >= 0 or a single integer

Hi All,

I have 4 GPUs in my machine and I am using Dataparallel. I have set the device as:
torch.cuda.set_device(0) However I am getting this error when I have batch size of 1. Could you please suggest what might be the problem?

Traceback (most recent call last): File "single_evaluate.py", line 105, in <module> test(model, manager) File "single_evaluate.py", line 44, in test output_batch = model(data_batch) File "/home/nishanth/anaconda3/envs/try_midas/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/home/nishanth/anaconda3/envs/try_midas/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 162, in forward return self.gather(outputs, self.output_device) File "/home/nishanth/anaconda3/envs/try_midas/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 174, in gather return gather(outputs, output_device, dim=self.dim) File "/home/nishanth/anaconda3/envs/try_midas/lib/python3.7/site-packages/torch/nn/parallel/scatter_gather.py", line 68, in gather res = gather_map(outputs) File "/home/nishanth/anaconda3/envs/try_midas/lib/python3.7/site-packages/torch/nn/parallel/scatter_gather.py", line 62, in gather_map for k in out)) File "/home/nishanth/anaconda3/envs/try_midas/lib/python3.7/site-packages/torch/nn/parallel/scatter_gather.py", line 62, in <genexpr> for k in out)) File "/home/nishanth/anaconda3/envs/try_midas/lib/python3.7/site-packages/torch/nn/parallel/scatter_gather.py", line 63, in gather_map return type(out)(map(gather_map, zip(*outputs))) File "/home/nishanth/anaconda3/envs/try_midas/lib/python3.7/site-packages/torch/nn/parallel/scatter_gather.py", line 63, in gather_map return type(out)(map(gather_map, zip(*outputs))) File "/home/nishanth/anaconda3/envs/try_midas/lib/python3.7/site-packages/torch/nn/parallel/scatter_gather.py", line 63, in gather_map return type(out)(map(gather_map, zip(*outputs))) TypeError: expected sequence object with len >= 0 or a single integer

We recommend DistributedDataParallel over DataParallel. Perhaps, you can try DistributedDataParallel out first instead of trying to debug your current DataParallel script?