Skip to main content

omnibias.keras.activations.nqs

0.0.2a1AlphaPython >=3.10Apache-2.0

Keras 3 operator layers and activation paths implemented with keras.ops for TensorFlow, JAX, or Torch.

import omnibias.keras.activations.nqs
Module contract & mathematical conventions

NQS-friendly activations: log_cosh, softabs, smooth_sign, mish.

Canonical building blocks of neural-quantum-state ansatze. Mirrors omnibias.torch.activations.nqs (and omnibias.jax.activations) on keras.ops so all backends register the same names.

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

LOG_COSH​

omnibias.keras.activations.nqs.LOG_COSHSource ↗
LOG_COSH = register_activation(ActivationSpec(name='log_cosh', forward=_log_cosh_forward, derivative=lambda z: ops.tanh(z), fastpath=_log_cosh_fastpath, riccati_polynomial=None, noise_model='laplace_smoothed', operator_role='Smooth-|z| activation: log(cosh(z)) ~ |z| for large |z|, ~ z^2/2 for small. Standard log-amplitude in spin-NQS; first derivative is tanh, second is 1 - tanh^2.', aliases=('logcosh',)))

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
LOG_COSH = register_activation(
    ActivationSpec(
        name="log_cosh",
        forward=_log_cosh_forward,
        derivative=lambda z: ops.tanh(z),
        fastpath=_log_cosh_fastpath,
        riccati_polynomial=None,
        noise_model="laplace_smoothed",
        operator_role=(
            "Smooth-|z| activation: log(cosh(z)) ~ |z| for large |z|, "
            "~ z^2/2 for small. Standard log-amplitude in spin-NQS; "
            "first derivative is tanh, second is 1 - tanh^2."
        ),
        aliases=("logcosh",),
    )
)
CONSTANT

MISH​

omnibias.keras.activations.nqs.MISHSource ↗
MISH = register_activation(ActivationSpec(name='mish', forward=_mish_forward, derivative=_mish_derivative, fastpath=_mish_fastpath, riccati_polynomial=None, noise_model='none', operator_role='Mish: z * tanh(softplus(z)). Self-gated residual activation.'))

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
MISH = register_activation(
    ActivationSpec(
        name="mish",
        forward=_mish_forward,
        derivative=_mish_derivative,
        fastpath=_mish_fastpath,
        riccati_polynomial=None,
        noise_model="none",
        operator_role=("Mish: z * tanh(softplus(z)). Self-gated residual activation."),
    )
)
CONSTANT

SMOOTH_SIGN​

omnibias.keras.activations.nqs.SMOOTH_SIGNSource ↗
SMOOTH_SIGN = register_activation(ActivationSpec(name='smooth_sign', forward=_smooth_sign_forward, derivative=_smooth_sign_derivative, fastpath=_smooth_sign_fastpath, integral=_smooth_sign_integral, riccati_polynomial=None, noise_model='symmetric_bernoulli_tempered', operator_role='Temperature-controlled smooth sign: tanh(z/T) -> sign(z) as T -> 0. The beta-tempered sign surrogate; used in variational annealing schedules.', aliases=('soft_sign',), 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
SMOOTH_SIGN = register_activation(
    ActivationSpec(
        name="smooth_sign",
        forward=_smooth_sign_forward,
        derivative=_smooth_sign_derivative,
        fastpath=_smooth_sign_fastpath,
        integral=_smooth_sign_integral,
        riccati_polynomial=None,
        noise_model="symmetric_bernoulli_tempered",
        operator_role=(
            "Temperature-controlled smooth sign: tanh(z/T) -> sign(z) as "
            "T -> 0. The beta-tempered sign surrogate; used in variational "
            "annealing schedules."
        ),
        aliases=("soft_sign",),
        limit_pos_inf=1.0,
        limit_neg_inf=-1.0,
    )
)
CONSTANT

SOFTABS​

omnibias.keras.activations.nqs.SOFTABSSource ↗
SOFTABS = register_activation(ActivationSpec(name='softabs', forward=_softabs_forward, derivative=_softabs_derivative, fastpath=_softabs_fastpath, integral=_softabs_integral, riccati_polynomial=None, noise_model='huber_smoothed', operator_role='Smooth absolute value: sqrt(z^2 + eps^2) - eps. C^2 everywhere; the eps-tempered abs surrogate (-> |z| as eps -> 0); useful in Jastrow factors and complex-amplitude magnitudes.', aliases=('soft_abs',)))

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
SOFTABS = register_activation(
    ActivationSpec(
        name="softabs",
        forward=_softabs_forward,
        derivative=_softabs_derivative,
        fastpath=_softabs_fastpath,
        integral=_softabs_integral,
        riccati_polynomial=None,
        noise_model="huber_smoothed",
        operator_role=(
            "Smooth absolute value: sqrt(z^2 + eps^2) - eps. C^2 everywhere; "
            "the eps-tempered abs surrogate (-> |z| as eps -> 0); useful in "
            "Jastrow factors and complex-amplitude magnitudes."
        ),
        aliases=("soft_abs",),
    )
)