Skip to main content

Quickstart

This page gets you from pip install to a closed-form Laplacian in a few minutes. Pick your backend.

1. The derivative tower

import torch
from omnibias.torch import get_activation

spec = get_activation("tanh")
z = torch.linspace(-2, 2, 5)

# σ, σ', σ'', σ''' - all from one evaluation, closed form.
for n in range(4):
print(n, spec.fastpath(z, n))

The cost of the 3rd derivative is the same as the 1st: one tanh evaluation plus a polynomial recurrence.

2. An operator-typed layer

The OperatorBlock is a typed scalar operator. Its op tag selects what the layer computes from the same base activation.

from omnibias.torch import OMBU, OperatorBlock, cmbLinear

# OMBU: trainable K-bias operator, drop-in for an activation.
ombu = OMBU(num_channels=4, K=2, base="tanh")
out = ombu(torch.zeros(8, 4))

# Typed operator: identity | grad | laplacian | derivative | band | integral
laplacian = OperatorBlock(channels=8, op="laplacian", base="gaussian")

# cmbLinear: nn.Linear with an inline OperatorBlock
fc = cmbLinear(in_features=128, out_features=64, op="identity", base="tanh")

See Operator-typed layers for the full op dictionary.

3. A closed-form Laplacian

For a one-layer scalar field on ℝ^D, the value, gradient, and Laplacian come back together — one activation-tower evaluation, O(1) overhead in D.

import jax.numpy as jnp
from omnibias.jax import neural_field_value_grad_laplacian

# field params: W (H, D), beta (H,), c (H,), b scalar; activation by name
val, grad, lap = neural_field_value_grad_laplacian(x, W, beta, c, b, "tanh")

For high-order PDEs, the iterated Laplacian stays flat in k:

from omnibias.jax import neural_field_polylaplacian

d4 = neural_field_polylaplacian(x, W, beta, c, b, "tanh", k=2) # biharmonic Δ²
Verify against autodiff

On your own problem, compare the closed-form Laplacian against jax.hessian (trace) or torch.func.hessian. They should agree to float64 round-off — that is the whole point. See Cross-backend parity.

Next steps