Skip to main content

omnibias.torch.activations.smooth

0.5.0rc1Release candidatePython >=3.10Apache-2.0

PyTorch activation derivatives, trainable operator layers, network jets, and direct differential-operator contractions.

import omnibias.torch.activations.smooth
Module contract & mathematical conventions

Smooth Riccati-class activations: sigmoid, tanh, softplus, gaussian.

Each one has a closed-form derivative tower, so its ActivationSpec carries a fast-path kernel that evaluates sigma^(n)(z) with one base activation call regardless of order.

Shared formulas do not imply universal floating-point identity. Verify dtype, shape, derivative-order support, and the stated numerical assumptions for the path you use.

CONSTANT

GAUSSIAN​

omnibias.torch.activations.smooth.GAUSSIANSource ↗
GAUSSIAN = register_activation(ActivationSpec(name='gaussian', forward=_gaussian, derivative=_gaussian_derivative, fastpath=gaussian_nth_derivative, integral=_gaussian_integral, riccati_polynomial=None, noise_model='gaussian_kernel', operator_role='K=2 collapse -> -z * exp(-z^2/2); RBF/Hermite spectral basis, Laplacian-of-Gaussian and Difference-of-Gaussian conv kernels.', aliases=('rbf',), limit_pos_inf=0.0, limit_neg_inf=0.0))

This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.

Read the implementation
GAUSSIAN = register_activation(
    ActivationSpec(
        name="gaussian",
        forward=_gaussian,
        derivative=_gaussian_derivative,
        fastpath=gaussian_nth_derivative,
        integral=_gaussian_integral,
        riccati_polynomial=None,  # not Riccati in g itself; uses Hermite tower instead.
        noise_model="gaussian_kernel",
        operator_role=(
            "K=2 collapse -> -z * exp(-z^2/2); RBF/Hermite spectral basis, "
            "Laplacian-of-Gaussian and Difference-of-Gaussian conv kernels."
        ),
        aliases=("rbf",),
        limit_pos_inf=0.0,
        limit_neg_inf=0.0,
    )
)
CONSTANT

SIGMOID​

omnibias.torch.activations.smooth.SIGMOIDSource ↗
SIGMOID = register_activation(ActivationSpec(name='sigmoid', forward=_sigmoid, derivative=_sigmoid_derivative, fastpath=sigmoid_nth_derivative, tower=sigmoid_tower, integral=_sigmoid_integral, riccati_polynomial=(0.0, 1.0, -1.0), noise_model='bernoulli', operator_role='K=2 collapse -> Bernoulli variance s(1-s); Newton/IRLS step for logistic regression.', aliases=('logistic',), limit_pos_inf=1.0, limit_neg_inf=0.0))

This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.

Read the implementation
SIGMOID = register_activation(
    ActivationSpec(
        name="sigmoid",
        forward=_sigmoid,
        derivative=_sigmoid_derivative,
        fastpath=sigmoid_nth_derivative,
        tower=sigmoid_tower,
        integral=_sigmoid_integral,
        riccati_polynomial=(0.0, 1.0, -1.0),  # P(s) = s - s^2
        noise_model="bernoulli",
        operator_role=(
            "K=2 collapse -> Bernoulli variance s(1-s); Newton/IRLS step for logistic regression."
        ),
        aliases=("logistic",),
        limit_pos_inf=1.0,
        limit_neg_inf=0.0,
    )
)
CONSTANT

SOFTPLUS​

omnibias.torch.activations.smooth.SOFTPLUSSource ↗
SOFTPLUS = register_activation(ActivationSpec(name='softplus', forward=_softplus, derivative=_softplus_derivative, fastpath=softplus_nth_derivative, tower=softplus_tower, riccati_polynomial=None, noise_model='bernoulli', operator_role='K=2 collapse -> sigmoid (Bernoulli mean); log-link Newton step / canonical PINN base for diffusion-class PDEs.', limit_neg_inf=0.0))

This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.

Read the implementation
SOFTPLUS = register_activation(
    ActivationSpec(
        name="softplus",
        forward=_softplus,
        derivative=_softplus_derivative,
        fastpath=softplus_nth_derivative,
        tower=softplus_tower,
        riccati_polynomial=None,  # softplus itself is not in Riccati form,
        # but its derivative tower from order >= 1 is (sigmoid's tower).
        noise_model="bernoulli",
        operator_role=(
            "K=2 collapse -> sigmoid (Bernoulli mean); "
            "log-link Newton step / canonical PINN base for diffusion-class PDEs."
        ),
        limit_neg_inf=0.0,  # softplus -> 0 as z -> -inf; diverges as z -> +inf
    )
)
CONSTANT

TANH​

omnibias.torch.activations.smooth.TANHSource ↗
TANH = register_activation(ActivationSpec(name='tanh', forward=_tanh, derivative=_tanh_derivative, fastpath=tanh_nth_derivative, tower=tanh_tower, integral=_tanh_integral, riccati_polynomial=(1.0, 0.0, -1.0), noise_model='symmetric_bernoulli', operator_role='K=2 collapse -> 1 - tanh^2; symmetric IRLS bell, useful as a saturation-aware feature gate.', limit_pos_inf=1.0, limit_neg_inf=-1.0))

This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.

Read the implementation
TANH = register_activation(
    ActivationSpec(
        name="tanh",
        forward=_tanh,
        derivative=_tanh_derivative,
        fastpath=tanh_nth_derivative,
        tower=tanh_tower,
        integral=_tanh_integral,
        riccati_polynomial=(1.0, 0.0, -1.0),  # P(t) = 1 - t^2
        noise_model="symmetric_bernoulli",
        operator_role=(
            "K=2 collapse -> 1 - tanh^2; symmetric IRLS bell, "
            "useful as a saturation-aware feature gate."
        ),
        limit_pos_inf=1.0,
        limit_neg_inf=-1.0,
    )
)