import tensorflow as tf

            if int(X.get_shape()[-1]) != (r**2) * n_out_channels:
                raise Exception(_err_log)
            # bsize, a, b, c = X.get_shape().as_list()
            # bsize = tf.shape(X)[0] # Handling Dimension(None) type for undefined batch dim
            # Xs=tf.split(X,r,3) #b*h*w*r*r
            # Xr=tf.concat(Xs,2) #b*h*(r*w)*r
            # X=tf.reshape(Xr,(bsize,r*a,r*b,n_out_channel)) # b*(r*h)*(r*w)*c

            X = tf.depth_to_space(X, r)
        else:
            raise RuntimeError(_err_log)

        return X


class SubpixelConv1d(Layer):
