"tests/git@developer.sourcefind.cn:OpenDAS/mmcv.git" did not exist on "c1de4c9bbf427b3786546eb16caf37f29cc39651"
Unverified Commit 95273020 authored by Qiza-lyhm's avatar Qiza-lyhm Committed by GitHub
Browse files

[Fix] Fix the output of scatter on MLU device (#1881)

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.
parent aee596d5
...@@ -16,7 +16,7 @@ def scatter(inputs, target_mlus, dim=0): ...@@ -16,7 +16,7 @@ def scatter(inputs, target_mlus, dim=0):
if isinstance(obj, torch.Tensor): if isinstance(obj, torch.Tensor):
if target_mlus != [-1]: if target_mlus != [-1]:
obj = obj.to('mlu') obj = obj.to('mlu')
return obj return [obj]
else: else:
# for CPU inference we use self-implemented scatter # for CPU inference we use self-implemented scatter
return Scatter.forward(target_mlus, obj) return Scatter.forward(target_mlus, obj)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment