def _inverse(self, y, yy, nlf0=None, nlf1=None, iso=None, cam=None): scale = gain_model_params_ex1(iso) # tf.summary.histogram('fitSDN_beta1', beta1) # tf.summary.histogram('fitSDN_beta2', beta2) x = y if scale is not None: x /= scale if self._last_layer: return tf.layers.flatten(x) return x
def _inverse_log_det_jacobian(self, z, yy, nlf0=None, nlf1=None, iso=None, cam=None): scale = gain_model_params_ex1(iso) # tf.summary.histogram('fitSDN_beta1', beta1) # tf.summary.histogram('fitSDN_beta2', beta2) if scale is None: return tf.constant(0., dtype=z.dtype, name="ildj") return -tf.log(scale)
def _forward_log_det_jacobian(self, x, yy, nlf0=None, nlf1=None, iso=None, cam=None): if self._last_layer: x = tf.reshape(x, (-1, self.i0, self.i1, self.ic)) # yy = tf.reshape(yy, (-1, self.i0, self.i1, self.ic)) scale = gain_model_params_ex1(iso) if scale is None: return tf.constant(0., dtype=x.dtype, name="fldj") return tf.log(scale)
def _forward(self, x, yy, nlf0=None, nlf1=None, iso=None, cam=None): if self._last_layer: x = tf.reshape(x, (-1, self.i0, self.i1, self.ic)) # yy = tf.reshape(yy, (-1, self.i0, self.i1, self.ic)) # if yy.shape[1] == 2 * x.shape[1]: # needs squeezing # yy = squeeze2d(yy, 2) scale = gain_model_params_ex1(iso) shift = 0.0 y = x if scale is not None: y *= scale if shift is not None: y += shift return y
def _inverse_and_log_det_jacobian(self, y, yy, nlf0=None, nlf1=None, iso=None, cam=None): scale = gain_model_params_ex1(iso) tf.summary.histogram('gain/scale', scale) x = y if scale is not None: x /= scale if scale is None: log_abs_det_J_inv = tf.constant(0., dtype=y.dtype, name="ildj") else: log_abs_det_J_inv = -tf.log(scale) if self._last_layer: return tf.layers.flatten(x), log_abs_det_J_inv return x, log_abs_det_J_inv