def METHOD_NAME(x, groups):
    # type: (torch.Tensor, int) -> torch.Tensor
    batchsize, num_channels, height, width = x.size()
    channels_per_group = int(num_channels/groups)
    # reshape
    x = x.view([batchsize, groups, channels_per_group, height, width])
    x = torch.transpose(x, 1, 2).contiguous()
    # flatten
    x = x.view(batchsize, -1, height, width)
    return x