DataParallel for multiple inputs

Hi,

I’m interested in parallelizing a model that contains both a classification network and a loss model.
As such I want to pass to the model both images (to be classified) and their targets, which are both Tensors.
However, applying model = torch.nn.DataParallel(model device_ids=[0,1]), and then model(images, targets) results in “Tensors not supported in scatter” error.

I was wondering if this is indeed possible to do?

BTW, the model works as expected on a single GPU.

Thank you.

wouldn’t the input to model have to be Variables and not Tensors? Is that the issue maybe?

Indeed that was the issue.

Thank you very much for your help.