def pixel_shuffle_1d(x, upscale_factor):
    """
    Performs a pixel shuffle on the input signal
    :param x:              The input tensor to be dimension shuffled
    :param upscale_factor: The upsample factor
    :return: The shuffled tensor
    """

    batch_size, channels, steps = x.size()
    channels //= upscale_factor
    input_view = x.contiguous().view(batch_size, channels, upscale_factor, steps)
    shuffle_out = input_view.permute(0, 1, 3, 2).contiguous()

    return shuffle_out.view(batch_size, channels, steps * upscale_factor)