Y = tanh(X), therefore Y in (-1, 1).

tfb_tanh(validate_args = FALSE, name = "tanh")

Arguments

validate_args

Logical, default FALSE. Whether to validate input with asserts. If validate_args is FALSE, and the inputs are invalid, correct behavior is not guaranteed.

name

name prefixed to Ops created by this class.

Value

a bijector instance.

Details

This can be achieved by an affine transform of the Sigmoid bijector, i.e., it is equivalent to

tfb_chain(list(tfb_affine(shift = -1, scale = 2), tfb_sigmoid(), tfb_affine(scale = 2)))

However, using the Tanh bijector directly is slightly faster and more numerically stable.

See also