class Add(nn.Module):
    def __init__(self, scope=None):
        nn.Module.__init__(self)

    def forward(self, bottoms):
        # bottoms is a list of tensor.
        assert len(bottoms) > 1, "The length of bottoms must be larger than 1."
        result = bottoms[0]
        for i in range(1, len(bottoms)):
            result = result + bottoms[i]
        return [result]

My model use the Add layer, it’s the subclass of nn.Module. When I use DataParallel to train my model, the runerror happened, “Expected tensor for argument #1 ‘input’ to have the same device as tensor for argument #2 ‘weight’;”. It’s OK when I use a single GPU;
What should I do make it train normally;