def inv_clipping_sigma(x, max_in): xx = x.clip(-0.99*max_in, 0.99*max_in) return (max_in * numpy.arctanh(xx / max_in)).clip(-max_in, max_in)