Skip to content

Commit

Permalink
[Fix] Fix the output of scatter on MLU device (#1881)
Browse files Browse the repository at this point in the history
To have the same shape of MLU copy and Scatter.forward, a 1-dim list has to be added.

Origin MMDP / MMDDP with this scatter_gather returns a list of tensor for each targets, and here MLU copy returns the same shape Tensor in a list of just one default target.
  • Loading branch information
Qiza-lyhm authored Apr 15, 2022
1 parent aee596d commit 9527302
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mmcv/device/mlu/scatter_gather.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def scatter_map(obj):
if isinstance(obj, torch.Tensor):
if target_mlus != [-1]:
obj = obj.to('mlu')
return obj
return [obj]
else:
# for CPU inference we use self-implemented scatter
return Scatter.forward(target_mlus, obj)
Expand Down

0 comments on commit 9527302

Please sign in to comment.