import tensorflow as tf

    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):
    """
