@classmethod
def decoder(cls, inputs, **kwargs):
    """ Create decoder with a given number of upsampling stages

        Parameters
        ----------
        inputs
            input tensor

        Returns
        -------
        nn.Module
        """
    steps = kwargs.pop('num_stages', len(inputs) - 1)
    factor = kwargs.pop('factor')
    if isinstance(factor, int):
        factor = int(factor ** (1 / steps))
        factor = [factor] * steps
    elif not isinstance(factor, list):
        raise TypeError(
            'factor should be int or list of int, but %s was given' % type(
            factor))
    x = inputs[-1]
    for i in range(steps):
        x = cls.upsample(x, factor=factor[i], **kwargs)
    return x
