Skip to content
class

SinhBackward

SinhBackward

Python wrappers

Public Python APIs implemented by this engine symbol.

Autograd node for element-wise hyperbolic sine y=sinh⁡(x)y = \sinh(x).

Saves the input x so the backward pass can evaluate cosh⁡(x)\cosh(x) and scale the upstream gradient by it. Defined on all of R\mathbb{R} with the identity sinh⁡(x)=(ex−e−x)/2\sinh(x) = (e^x - e^{-x})/2.

Math

\frac{\partial y}{\partial x} = \cosh(x), \qquad \frac{\partial \mathcal{L}}{\partial x} = \cosh(x)\,\frac{\partial \mathcal{L}}{\partial y}.$$

Attributes

schema_v1OpSchema
Registered as "sinh" with AmpPolicy::Promote.

Notes

Dispatch: Accelerate vvsinhf/vvsinh (CPU) / MLX sinh (GPU). Output magnitude grows exponentially; large-magnitude inputs can overflow to +inf / -inf.

Static methods

1
static

dispatch

int dispatch(backend::IBackend & be, const int & a, const int & s, Dtype dt)

Forward — calls IBackend::sinh to compute y=sinh⁡xy = \sinh x.

Methods

2
fn

grad_formula

int grad_formula(const int & g)

Backward — ∂y/∂x=cosh⁡x\partial y/\partial x = \cosh x, scaled by grad_out.

fn

grad_formula_impl

int grad_formula_impl(const int & g, const int & x, const int &)

Graph-mode backward: the same derivative built from composable ops, so the gradient itself stays differentiable.