normalizing-flows icon indicating copy to clipboard operation
normalizing-flows copied to clipboard

constraint for invertibility

Open chanshing opened this issue 6 years ago • 1 comments

Thanks for the nice work. May I know how and where do you enforce the constraint required to obtain invertible flows? Specifically, the condition w^Tu >= -1 as described in the appendix of the Normalizing flows paper.

chanshing avatar Feb 07 '19 21:02 chanshing

Thanks!

The following lines handle the condition. We construct u_hat that follows the condition required.

u_hat = (m(tf.tensordot(w, u, 2)) - tf.tensordot(w, u, 2)) * (w / tf.norm(w)) + u
affine = h_prime(tf.expand_dims(tf.reduce_sum(z_prev * w, -1), -1) + b) * w
sum_log_det_jacob += tf.log(eps + tf.abs(1 + tf.reduce_sum(affine * u_hat, -1)))
z_prev = z_prev + u_hat * h(tf.expand_dims(tf.reduce_sum(z_prev * w, -1), -1) + b)

abdulfatir avatar Feb 08 '19 10:02 abdulfatir