Skip to content

nn parallel scatter/gather ops do not support tuple inputs #242

@ngimel

Description

@ngimel

nn parallel scatter/gather ops do not support tuple inputs (see the trace below). That happens when a network has more than one output rather than a single tensor, e.g., in segmentation workloads. The error below can be reproduced with imagenet sample, by modifying model to return x,x rather than return x in line 138 of resnet.py. We are working around that by concatenating outputs and then using custom criterion that unpacks them again, but would be nice to have support for this.

  File "main.py", line 75, in forward
    return nn.parallel.data_parallel(self.model, input, gpu_ids)
  File "/home/ngimelshein/.local/lib/python2.7/site-packages/torch/nn/parallel/__init__.py", line 38, in data_parallel
    return gather(outputs, output_device)
  File "/home/ngimelshein/.local/lib/python2.7/site-packages/torch/nn/parallel/__init__.py", line 21, in gather
    return Gather(target_device)(*variables)
RuntimeError: expected a Variable argument, but got tuple

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions