def forward_and_jacobian(self, x, sum_log_det_jacobians, z):
with tf.variable_scope(self.name):
xs = int_shape(x)
b = self.get_mask(xs, self.mask_type)
# masked half of x
x1 = x * b
l,m = self.function_l_m(x1, b)
y = x1 + tf.mul(-b+1.0, x*tf.check_numerics(tf.exp(l), "exp has NaN") + m)
log_det_jacobian = tf.reduce_sum(l, [1,2,3])
sum_log_det_jacobians += log_det_jacobian
return y,sum_log_det_jacobians, z
评论列表
文章目录