import tensorflow as tf

        log_sigmas = self.parameterizer(x1)
        x2, ildj = half_gaussianize(z2, log_sigmas, inverse=tf.constant(True))
        return x2, ildj
    
def exponentiate(x, log_lambdas, inverse=tf.constant(False)):
    if not inverse:
        z = tf.math.exp(log_lambdas)*x
        ldj = tf.math.reduce_sum(log_lambdas, axis=[1,2,3])
    else:
        z = x*tf.math.exp(-log_lambdas)
        ldj = -tf.math.reduce_sum(log_lambdas, axis=[1,2,3])
    return z, ldj

class Exponentiate(Parameterize):
    """
    Implementation of parameterize for an exponetial prior.
    """
    def __init__(self, input_shape=None, name='gaussianize', *args, **kwargs):
