From 5431dd2739c5213ad9febe4164e2cdc2f326ddef Mon Sep 17 00:00:00 2001 From: Qiza-lyhm Date: Fri, 15 Apr 2022 16:53:21 +0800 Subject: [PATCH] [Fix]Add dimensions to MLU copy 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. --- mmcv/device/mlu/scatter_gather.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmcv/device/mlu/scatter_gather.py b/mmcv/device/mlu/scatter_gather.py index a3cbbd3a79..0b0c9b96f5 100644 --- a/mmcv/device/mlu/scatter_gather.py +++ b/mmcv/device/mlu/scatter_gather.py @@ -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)