import tensorflow as tf

        z = tf.math.exp(log_sigmas)*x
        ldj = tf.math.reduce_sum(log_sigmas, axis=[1,2,3])
    else:
        z = x*tf.math.exp(-log_sigmas)
        ldj = -tf.math.reduce_sum(log_sigmas, axis=[1,2,3])
    return z, ldj

class HalfGaussianize(Parameterize):
