Exemple #1
0
 def _get_arctanh_x(self, x):
     # Carlini's original implementation uses a slightly different formula because
     # the image space is [-0.5, 0.5] instead of [clip_min, clip_max]
     result = clamp((x - self.clip_min) / (self.clip_max - self.clip_min),
                    min=0.,
                    max=1.) * 2 - 1
     return torch_arctanh(result * ONE_MINUS_EPS)
Exemple #2
0
 def _get_arctanh_x(self, x):
     result = clamp((x - self.clip_min) / (self.clip_max - self.clip_min),
                    min=self.clip_min,
                    max=self.clip_max) * 2 - 1
     return torch_arctanh(result * ONE_MINUS_EPS)