def SubPixel1D_multichan(I, r):
    'One-dimensional subpixel upsampling layer\n\n  Calls a tensorflow function that directly implements this functionality.\n  We assume input has dim (batch, width, r).\n\n  Works with multiple channels: (B,L,rC) -> (B,rL,C)\n  '
    with tf.compat.v1.name_scope('subpixel'):
        (_, w, rc) = I.get_shape()
        assert ((rc % r) == 0)
        c = (rc / r)
        X = tf.transpose(a=I, perm=[2, 1, 0])
        X = tf.batch_to_space(X, [r], [[0, 0]])
        X = tf.transpose(a=X, perm=[2, 1, 0])
        return X
One-dimensional subpixel upsampling layer

Calls a tensorflow function that directly implements this functionality.
We assume input has dim (batch, width, r).

Works with multiple channels: (B,L,rC) -> (B,rL,C)
def SubPixel1D_multichan(I, r):
    'One-dimensional subpixel upsampling layer\n\n  Calls a tensorflow function that directly implements this functionality.\n  We assume input has dim (batch, width, r).\n\n  Works with multiple channels: (B,L,rC) -> (B,rL,C)\n  '
    with tf.compat.v1.name_scope('subpixel'):
        (_, w, rc) = I.get_shape()
        assert ((rc % r) == 0)
        c = (rc / r)
        X = tf.transpose(a=I, perm=[2, 1, 0])
        X = tf.batch_to_space(X, [r], [[0, 0]])
        X = tf.transpose(a=X, perm=[2, 1, 0])
        return X