def forward(self, x):
    (N, C, H, W) = x.size()
    y = x.clone()
    x = self.net1.base(x)
    y = self.net2.base(y)
    (xs, ys) = ([], [])
    for stage_id in range(self.num_stages):
        x = self.net1.stages[stage_id](x)
        y = self.net2.stages[stage_id](y)
        if isinstance(x, list):
            (x[0], y[0]) = self.nddrs['nddrs'][stage_id](x[0], y[0])
        else:
            (x, y) = self.nddrs['nddrs'][stage_id](x, y)
        if (self.aux and self.training and (stage_id in self.cfg.TRAIN.AUX_LAYERS)):
            xs.append(x)
            ys.append(y)
    x = self.net1.head(x)
    y = self.net2.head(y)
    result = AttrDict({'out1': x, 'out2': y})
    if (self.aux and self.training):
        (_, _, h, w) = x.size()
        aux_x = torch.cat(([F.interpolate(_x, (h, w), mode='bilinear', align_corners=True) for _x in xs[:(- 1)]] + [xs[(- 1)]]), dim=1)
        aux_y = torch.cat(([F.interpolate(_y, (h, w), mode='bilinear', align_corners=True) for _y in ys[:(- 1)]] + [ys[(- 1)]]), dim=1)
        result.aux1 = self.aux_conv1(aux_x)
        result.aux2 = self.aux_conv2(aux_y)
    return result
def forward(self, x):
    (N, C, H, W) = x.size()
    y = x.clone()
    x = self.net1.base(x)
    y = self.net2.base(y)
    (xs, ys) = ([], [])
    for stage_id in range(self.num_stages):
        x = self.net1.stages[stage_id](x)
        y = self.net2.stages[stage_id](y)
        if isinstance(x, list):
            (x[0], y[0]) = self.nddrs['nddrs'][stage_id](x[0], y[0])
        else:
            (x, y) = self.nddrs['nddrs'][stage_id](x, y)
        if (self.aux and self.training and (stage_id in self.cfg.TRAIN.AUX_LAYERS)):
            xs.append(x)
            ys.append(y)
    x = self.net1.head(x)
    y = self.net2.head(y)
    result = AttrDict({'out1': x, 'out2': y})
    if (self.aux and self.training):
        (_, _, h, w) = x.size()
        aux_x = torch.cat(([F.interpolate(_x, (h, w), mode='bilinear', align_corners=True) for _x in xs[:(- 1)]] + [xs[(- 1)]]), dim=1)
        aux_y = torch.cat(([F.interpolate(_y, (h, w), mode='bilinear', align_corners=True) for _y in ys[:(- 1)]] + [ys[(- 1)]]), dim=1)
        result.aux1 = self.aux_conv1(aux_x)
        result.aux2 = self.aux_conv2(aux_y)
    return result