latest (dev)
Copy
Latest development documentation · Updated 2026-10-08
TanhTransform
- class tensorplay.distributions.TanhTransform(cache_size: int = 0)[source]
Transform via the mapping .
It is equivalent to
ComposeTransform( [ AffineTransform(0.0, 2.0), SigmoidTransform(), AffineTransform(-1.0, 2.0), ] )However this might not be numerically stable, thus it is recommended to use TanhTransform instead.
Note that one should use cache_size=1 when it comes to NaN/Inf values.
- forward_shape(shape)
Infers the shape of the forward computation, given the input shape. Defaults to preserving shape.
- property inv: Transform
Returns the inverse
Transformof this transform. This should satisfyt.inv.inv is t.
- inverse_shape(shape)
Infers the shapes of the inverse computation, given the output shape. Defaults to preserving shape.
Help improve this page
Found an error, an unclear step, or a missing example?
Was this page helpful?

