human
I wrote the below code

    _err_log = 'SubpixelConv2d:    The    number    of    input    channels    ==    (scale    x    scale)    x    The    number    of    output    channels'
    scope_name = tf.get_variable_scope().name
    if scope_name:
        name = ((scope_name + '/') + name)
    def _PS(X, r, n_out_channel):
        if (n_out_channel >= 1):
            assert (int(X.get_shape()[(-1)]) == ((r ** 2) * n_out_channel)), _err_log
            (bsize, a, b, c) = X.get_shape().as_list()
            bsize = tf.shape(X)[0]
            Xs = tf.split(X, r, 3)
            Xr = tf.concat(Xs, 2)
            X = tf.reshape(Xr, (bsize, (r * a), (r * b), n_out_channel))
        else:
            print _err_log
        return X
    inputs = net.outputs
    if (n_out_channel is None):
        assert (((int(inputs.get_shape()[(-1)]) / (scale ** 2)) % 1) == 0), _err_log
        n_out_channel = int((int(inputs.get_shape()[(-1)]) / (scale ** 2)))
    print ('        [TL]    SubpixelConv2d        %s:    scale:    %d    n_out_channel:    %s    act:    %s' % (name, scale, n_out_channel, act.__name__))
    net_new = Layer(inputs, name=name)
    with tf.variable_scope(name) as vs:
        net_new.outputs = act(_PS(inputs, r=scale, n_out_channel=n_out_channel))
    net_new.all_layers = list(net.all_layers)
    net_new.all_params = list(net.all_params)
    net_new.all_drop = dict(net.all_drop)
    net_new.all_layers.extend([net_new.outputs])
    return net_new

What's a good function header?
 ... What is a Python program to print _err_log?
assistant
#Here is Python program to print _err_log
.

def SubpixelConv2d(net, scale=2, n_out_channel=None, act=tf.identity, name='subpixel_conv2d'):