Quick fix of broken log_jacobian_tensor in transforms.Rescale
@@ -199,8 +199,9 @@ class Rescale(Transform):
return self.chain_transform.backward(y) / self.factor
def log_jacobian_tensor(self, x):
- return tf.cast(tf.reduce_prod(tf.shape(x)), settings.tf_float) * \
- self.factor * self.chain_transform.log_jacobian_tensor(x * self.factor)
+ N = tf.reduce_prod(tf.shape(x))
+ return tf.cast(N, settings.tf_float) * tf.log(self.factor) + \
+ self.chain_transform.log_jacobian_tensor(x * self.factor)
def __str__(self):
return "R" + self.chain_transform.__str__()
