import tensorflow as tf

                x = tf.reshape(scale_init, [1, num_units]) * (x - tf.reshape(m_init, [1, num_units]))

        else:
            V = maybe_avg(V)
            g = maybe_avg(g)
            b = maybe_avg(b)

            x = tf.matmul(x, V)
            scaler = g / tf.sqrt(tf.reduce_sum(tf.square(V), [0]))
            x = tf.reshape(scaler, [1, num_units]) * x + tf.reshape(b, [1, num_units])


        return x


def sample_from_discretized_mix_logistic(l, nr_mix):
    """
    This function is copied from https://github.com/openai/pixel-cnn/blob/master/pixel_cnn_pp/nn.py in reference to:
