omnibias.jax.architectures.ftc_net
JAX activation derivatives, functional network jets, direct contractions, and parameter-differentiable numerical models.
import omnibias.jax.architectures.ftc_netModule contract & mathematical conventions
FTC-Net + dual-FTC loss (jax; theory 09-03 / 09-17).
The cell is the integral role. The derivative head is FTC of the
same window. The founding bias collapse (delta -> 0) is the
collapse head I / delta. Temperature collapse (beta -> inf,
feasibility) does not appear. Do not conflate the two.
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.
Imports & aliases
These names share a definition with another public module. Follow a name for its full contract, parameters, and examples.
| Import from this module | Canonical reference |
|---|---|
DISCLAIMER | omnibias.core.ftc.DISCLAIMER |
DualFTCConfig | omnibias.core.ftc.DualFTCConfig |
FTCNetConfig | omnibias.core.ftc.FTCNetConfig |
honesty_payload | omnibias.core.ftc.honesty_payload |
worked_example | omnibias.core.ftc.worked_example |
FTCNet
omnibias.jax.architectures.FTCNetSource ↗class FTCNetConfig holder; evaluation is the closed-form pack sum in omnibias.core.ftc.
Parameters
| Name | Type & default | Contract |
|---|---|---|
configpositional-or-keyword | FTCNetConfig | NoneDefault: None | See the operation contract and implementation below. |
Executed regression · g1 matches core
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_g1_matches_core() -> None:
x = jnp.asarray(0.0)
w = jnp.asarray(1.0)
lo = jnp.asarray(-0.1)
hi = jnp.asarray(0.1)
integral, deriv, collapse = ftc_block(x, w, lo, hi)
ex = worked_example()
assert float(integral) == ex["I"]
assert float(deriv) == ex["dI"]
assert float(collapse) == ex["collapse"]
assert FTCNet(FTCNetConfig()).config.window == 0.6python -m pytest "packages/omnibias-jax/tests/test_ftc_net.py::test_g1_matches_core" -qFields & methods
__init__method
__init__(self, config: FTCNetConfig | None=None) -> NoneSee the class contract above and the exact method implementation below.
Parameters
| Name | Type & default | Contract |
|---|---|---|
configpositional-or-keyword | FTCNetConfig | NoneDefault: None | See the operation contract and implementation below. |
Returns: None
Executed regression · g1 matches core
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_g1_matches_core() -> None:
x = jnp.asarray(0.0)
w = jnp.asarray(1.0)
lo = jnp.asarray(-0.1)
hi = jnp.asarray(0.1)
integral, deriv, collapse = ftc_block(x, w, lo, hi)
ex = worked_example()
assert float(integral) == ex["I"]
assert float(deriv) == ex["dI"]
assert float(collapse) == ex["collapse"]
assert FTCNet(FTCNetConfig()).config.window == 0.6python -m pytest "packages/omnibias-jax/tests/test_ftc_net.py::test_g1_matches_core" -qMethod implementation
def __init__(self, config: FTCNetConfig | None = None) -> None:
self.config = FTCNetConfig() if config is None else configconfigattribute
config = FTCNetConfig() if config is None else configPublic instance attribute assigned by __init__. The source assignment is config = FTCNetConfig() if config is None else config; it describes instance state, not a literal constructor default.
Read the implementation
class FTCNet:
"""Config holder; evaluation is the closed-form pack sum in ``omnibias.core.ftc``."""
def __init__(self, config: FTCNetConfig | None = None) -> None:
self.config = FTCNetConfig() if config is None else configOther public import paths
omnibias.jax.architectures.FTCNetomnibias.jax.architectures.ftc_net.FTCNet
dual_ftc_loss
omnibias.jax.architectures.dual_ftc_lossSource ↗dual_ftc_loss(I_vals: Sequence[float] | Array, dI_vals: Sequence[float] | Array, f_vals: Sequence[float] | Array, F_vals: Sequence[float] | Array, *, config: DualFTCConfig | None=None, I_a: float | None=None) -> core_ftc.DualFTCResultThe module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.
Parameters
| Name | Type & default | Contract |
|---|---|---|
I_valspositional-or-keyword | Sequence[float] | ArrayRequired | See the operation contract and implementation below. |
dI_valspositional-or-keyword | Sequence[float] | ArrayRequired | See the operation contract and implementation below. |
f_valspositional-or-keyword | Sequence[float] | ArrayRequired | See the operation contract and implementation below. |
F_valspositional-or-keyword | Sequence[float] | ArrayRequired | See the operation contract and implementation below. |
configkeyword-only | DualFTCConfig | NoneDefault: None | See the operation contract and implementation below. |
I_akeyword-only | float | NoneDefault: None | See the operation contract and implementation below. |
core_ftc.DualFTCResultRead the implementation
def dual_ftc_loss(
I_vals: Sequence[float] | Array,
dI_vals: Sequence[float] | Array,
f_vals: Sequence[float] | Array,
F_vals: Sequence[float] | Array,
*,
config: DualFTCConfig | None = None,
I_a: float | None = None,
) -> core_ftc.DualFTCResult:
def _as_list(v: Sequence[float] | Array) -> list[float]:
if hasattr(v, "reshape"):
return [float(x) for x in jnp.asarray(v).reshape(-1).tolist()]
return [float(x) for x in v]
return core_ftc.dual_ftc_loss(
_as_list(I_vals),
_as_list(dI_vals),
_as_list(f_vals),
_as_list(F_vals),
config=core_ftc.DEFAULT_DUAL if config is None else config,
I_a=I_a,
)Other public import paths
omnibias.jax.architectures.dual_ftc_lossomnibias.jax.architectures.ftc_net.dual_ftc_loss
ftc_block
omnibias.jax.architectures.ftc_blockSource ↗ftc_block(x: Array, w: Array, b_lo: Array, b_hi: Array, *, activation: str='sigmoid') -> tuple[Array, Array, Array]mathematically equivalent to omnibias.core.ftc.ftc_block on scalars.
Backend scope: this identifies the corresponding mathematical construction. It does not guarantee bitwise-equal floating-point results across devices, compilers, dtypes, or backend versions. Validate the selected path with an appropriate absolute and relative tolerance.
Parameters
| Name | Type & default | Contract |
|---|---|---|
xpositional-or-keyword | ArrayRequired | See the operation contract and implementation below. |
wpositional-or-keyword | ArrayRequired | See the operation contract and implementation below. |
b_lopositional-or-keyword | ArrayRequired | See the operation contract and implementation below. |
b_hipositional-or-keyword | ArrayRequired | See the operation contract and implementation below. |
activationkeyword-only | strDefault: 'sigmoid' | See the operation contract and implementation below. |
tuple[Array, Array, Array]Executed regression · g1 matches core
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_g1_matches_core() -> None:
x = jnp.asarray(0.0)
w = jnp.asarray(1.0)
lo = jnp.asarray(-0.1)
hi = jnp.asarray(0.1)
integral, deriv, collapse = ftc_block(x, w, lo, hi)
ex = worked_example()
assert float(integral) == ex["I"]
assert float(deriv) == ex["dI"]
assert float(collapse) == ex["collapse"]
assert FTCNet(FTCNetConfig()).config.window == 0.6python -m pytest "packages/omnibias-jax/tests/test_ftc_net.py::test_g1_matches_core" -qRegression example · g4 worked example bit identical
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_g4_worked_example_bit_identical() -> None:
torch.set_default_dtype(torch.float64)
ti, td, tc = torch_ftc_block(
torch.tensor(0.0), torch.tensor(1.0), torch.tensor(-0.1), torch.tensor(0.1)
)
ji, jd, jc = jax_ftc_block(
jnp.asarray(0.0), jnp.asarray(1.0), jnp.asarray(-0.1), jnp.asarray(0.1)
)
assert float(ti) == float(ji)
assert float(td) == float(jd)
assert float(tc) == float(jc)python -m pytest tests/test_ftc_net_parity.py -k test_g4_worked_example_bit_identical -qRead the implementation
def ftc_block(
x: Array,
w: Array,
b_lo: Array,
b_hi: Array,
*,
activation: str = "sigmoid",
) -> tuple[Array, Array, Array]:
"""Bit-identical to :func:`omnibias.core.ftc.ftc_block` on scalars."""
xs = jnp.asarray(x).reshape(-1).tolist()
ws = jnp.asarray(w).reshape(-1).tolist()
los = jnp.asarray(b_lo).reshape(-1).tolist()
his = jnp.asarray(b_hi).reshape(-1).tolist()
n = max(len(xs), len(ws), len(los), len(his))
def _at(vals: list[float], i: int) -> float:
return vals[0] if len(vals) == 1 else vals[i]
integrals: list[float] = []
derivs: list[float] = []
collapses: list[float] = []
for i in range(n):
integral, deriv, collapse = core_ftc.ftc_block(
_at(xs, i), _at(ws, i), _at(los, i), _at(his, i), activation=activation
)
integrals.append(integral)
derivs.append(deriv)
collapses.append(collapse)
dtype = jnp.asarray(x).dtype
shape = jnp.asarray(x).shape
if shape == ():
return (
jnp.asarray(integrals[0], dtype=dtype),
jnp.asarray(derivs[0], dtype=dtype),
jnp.asarray(collapses[0], dtype=dtype),
)
return (
jnp.asarray(integrals, dtype=dtype).reshape(shape),
jnp.asarray(derivs, dtype=dtype).reshape(shape),
jnp.asarray(collapses, dtype=dtype).reshape(shape),
)Other public import paths
omnibias.jax.architectures.ftc_blockomnibias.jax.architectures.ftc_net.ftc_block