Python wrappers
Public Python APIs implemented by this engine symbols.Autograd node for element-wise hyperbolic tangent .
Saves the output rather than the input because the backward
formula is cheaper than re-evaluating and avoids a
second vvtanhf pass. kSavesInput = false opts out of the
default input-save behaviour and kSavesOutput = true registers the
output instead. Range is on all of .
Math
\frac{\partial y}{\partial x} = 1 - \tanh^2(x) = 1 - y^2, \qquad \frac{\partial \mathcal{L}}{\partial x} = (1 - y^2)\,\frac{\partial \mathcal{L}}{\partial y}.$$Attributes
schema_v1OpSchemaRegistered as
"tanh" with AmpPolicy::Promote.kSavesInputboolfalse.kSavesOutputbooltrue — the saved tensor is .Notes
Dispatch: Accelerate vvtanhf/vvtanh (CPU) / MLX tanh (GPU).