Skip to content
class

SoftplusBackward

SoftplusBackward

Python wrappers

Public Python APIs implemented by this engine symbols.

Autograd node for Softplus y=log⁡(1+ex)y = \log(1 + e^x) — the smooth surrogate of ReLU whose derivative is the logistic sigmoid.

Saves the input so grad_formula can recompute σ(x)\sigma(x) via the storage-level sigmoid primitive (a single MLX or Accelerate call).

Math

y=log⁡(1+ex),∂y∂x=σ(x)y = \log(1 + e^x), \qquad \frac{\partial y}{\partial x} = \sigma(x)

Attributes

schema_v1OpSchema
"softplus", AmpPolicy::ForceFP32 — guards against exe^x overflow in float16 for ∣x∣>11|x| > 11 or so.

Static methods

1
static

dispatch

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

Forward — calls IBackend::softplus to compute y=log⁡(1+ex)y = \log(1 + e^x).

Methods

2
fn

grad_formula

int grad_formula(const int & g)

Eager-mode backward: ∂L/∂x=σ(x)⋅∂L/∂y\partial L/\partial x = \sigma(x) \cdot \partial L/\partial y, evaluated via the storage-level sigmoid kernel applied to the saved input.

fn

grad_formula_impl

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