nn.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:real-nvp 作者: taesung89 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号