Use two DataParallel for two separate module

Hi I was trying to run two module separately with same input data,
so I did

    m1 = nn.DataParallel(m1)
    m2 = nn.DataParallel(m2)

then

   m1_output = m1(input_data)
   m2_output = m2(input_data)

for the first module m1, it runs correctly and returns m1_output, but for the second module m2, when it executes the line m2_output = m2(input_data), it prompts:

  File "/home/user/anaconda2/envs/tensorflow_/lib/python2.7/site-packages/torch/nn/modules/module.py", line 491, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/user/anaconda2/envs/tensorflow_/lib/python2.7/site-packages/torch/nn/parallel/data_parallel.py", line 115, in forward
    return self.gather(outputs, self.output_device)
  File "/home/user/anaconda2/envs/tensorflow_/lib/python2.7/site-packages/torch/nn/parallel/data_parallel.py", line 127, in gather
    return gather(outputs, output_device, dim=self.dim)
  File "/home/user/anaconda2/envs/tensorflow_/lib/python2.7/site-packages/torch/nn/parallel/scatter_gather.py", line 68, in gather
    return gather_map(outputs)
  File "/home/user/anaconda2/envs/tensorflow_/lib/python2.7/site-packages/torch/nn/parallel/scatter_gather.py", line 63, in gather_map
    return type(out)(map(gather_map, zip(*outputs)))
  File "/home/user/anaconda2/envs/tensorflow_/lib/python2.7/site-packages/torch/nn/parallel/scatter_gather.py", line 63, in gather_map
    return type(out)(map(gather_map, zip(*outputs)))
TypeError: zip argument #1 must support iteration

Can you show your module code? Did it work without DataParallel?

The module is a bit large, it is a faster rcnn module based on https://github.com/jwyang/faster-rcnn.pytorch, it works correctly without DataParallel, but with DataParallel, the problem happened

Hi, turns out there was a mistake, that the returned value for second module is not well specified, caused the error.

Hi, do you have any solutions? I also have the similar problems, which happens every several iterations.