My model have multiple outputs, and it works well on one GPU.
But when I using DataParallel
, it reports an error:
/usr/local/lib/python2.7/dist-packages/torch/_utils.py:112: UserWarning: src is not broadcastable to dst, but they have the same number of elements. Falling back to deprecated pointwise behavior.
flat.narrow(0, offset, numel).copy_(tensor)
Traceback (most recent call last):
File "baseline.py", line 119, in <module>
dset_loaders=dset_loaders, dset_classes=dset_classes, val_aug=val_aug, dis_margin=dis_margin)
File "/home/cv/ensemble/trainer_new.py", line 99, in train_model
outputs_0, outputs_1, outputs_2, fc3_distance, fc2_distance, fc1_distance, conv5_3_distance, conv4_3_distance, conv3_3_distance, conv2_3_distance, conv1_3_distance, fc3_weight_distance, fc2_weight_distance, fc1_weight_distance, conv5_3_weight_distance, conv4_3_weight_distance, conv3_3_weight_distance, conv2_3_weight_distance, conv1_3_weight_distance = model(inputs)
File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 206, in __call__
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/torch/nn/parallel/data_parallel.py", line 61, in forward
return self.gather(outputs, self.output_device)
File "/usr/local/lib/python2.7/dist-packages/torch/nn/parallel/data_parallel.py", line 73, in gather
return gather(outputs, output_device, dim=self.dim)
File "/usr/local/lib/python2.7/dist-packages/torch/nn/parallel/scatter_gather.py", line 50, in gather
return gather_map(outputs)
File "/usr/local/lib/python2.7/dist-packages/torch/nn/parallel/scatter_gather.py", line 49, in gather_map
return type(out)(map(gather_map, zip(*outputs)))
File "/usr/local/lib/python2.7/dist-packages/torch/nn/parallel/scatter_gather.py", line 49, in gather_map
return type(out)(map(gather_map, zip(*outputs)))
File "/usr/local/lib/python2.7/dist-packages/torch/nn/parallel/scatter_gather.py", line 49, in gather_map
return type(out)(map(gather_map, zip(*outputs)))
TypeError: zip argument #1 must support iteration
Could anyone help me with it?
Thanks!