def SubPixel1D_v2(I, r):
    'One-dimensional subpixel upsampling layer\n\n  Based on https://github.com/Tetrachrome/subpixel/blob/master/subpixel.py\n  '
    with tf.compat.v1.name_scope('subpixel'):
        (bsize, a, r) = I.get_shape().as_list()
        bsize = tf.shape(input=I)[0]
        X = tf.split(1, a, I)
        if ('axis' in tf.squeeze.__code__.co_varnames):
            X = tf.concat(1, [tf.squeeze(x, axis=1) for x in X])
        elif ('squeeze_dims' in tf.squeeze.__code__.co_varnames):
            X = tf.concat(1, [tf.squeeze(x, axis=[1]) for x in X])
        else:
            raise Exception('Unsupported version of tensorflow')
        return tf.reshape(X, (bsize, (a * r), 1))
One-dimensional subpixel upsampling layer

Based on https://github.com/Tetrachrome/subpixel/blob/master/subpixel.py
def SubPixel1D_v2(I, r):
    'One-dimensional subpixel upsampling layer\n\n  Based on https://github.com/Tetrachrome/subpixel/blob/master/subpixel.py\n  '
    with tf.compat.v1.name_scope('subpixel'):
        (bsize, a, r) = I.get_shape().as_list()
        bsize = tf.shape(input=I)[0]
        X = tf.split(1, a, I)
        if ('axis' in tf.squeeze.__code__.co_varnames):
            X = tf.concat(1, [tf.squeeze(x, axis=1) for x in X])
        elif ('squeeze_dims' in tf.squeeze.__code__.co_varnames):
            X = tf.concat(1, [tf.squeeze(x, axis=[1]) for x in X])
        else:
            raise Exception('Unsupported version of tensorflow')
        return tf.reshape(X, (bsize, (a * r), 1))