Skip to main content

omnibias.qcalculus.torch.hybrid

0.1.0a2AlphaPython >=3.10Apache-2.0

q-numbers, Jackson derivatives and integrals, q-series, and the ordinary-calculus limit as q approaches one.

import omnibias.qcalculus.torch.hybrid
Module contract & mathematical conventions

q-OMBU hybrid (torch; theory 09-15).

Named q -> 1 is not founding bias collapse (delta -> 0) and not temperature collapse (beta -> inf, feasibility). Ordinary sigma cells still use founding bias collapse. 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 moduleCanonical reference
DISCLAIMERomnibias.qcalculus.jax.hybrid.DISCLAIMER
QOMBUConfigomnibias.qcalculus.QOMBUConfig
honesty_payloadomnibias.qcalculus.jax.hybrid.honesty_payload
FUNCTION

q_ombu_forward​

omnibias.qcalculus.torch.q_ombu_forwardSource ↗
q_ombu_forward(x: Tensor, params: Sequence[float] | None=None, *, config: QOMBUConfig | None=None) -> tuple[Tensor, Tensor]

Returns (y, limit_residual).

Parameters

NameType & defaultContract
xpositional-or-keywordTensorRequiredSee the operation contract and implementation below.
paramspositional-or-keywordSequence[float] | NoneDefault: NoneSee the operation contract and implementation below.
configkeyword-onlyQOMBUConfig | NoneDefault: NoneSee the operation contract and implementation below.
Returnstuple[Tensor, Tensor]
Regression example · g4 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_bit_identical() -> None:
    torch.set_default_dtype(torch.float64)
    assert torch_ex()["y"] == jax_ex()["y"]
    t_y, t_r = torch_fwd(torch.tensor(2.0))
    j_y, j_r = jax_fwd(jnp.asarray(2.0))
    assert float(t_y) == float(j_y)
    assert float(t_r) == float(j_r)
python -m pytest tests/test_q_ombu_parity.py -k test_g4_bit_identical -q
Read the implementation
def q_ombu_forward(
    x: Tensor,
    params: Sequence[float] | None = None,
    *,
    config: QOMBUConfig | None = None,
) -> tuple[Tensor, Tensor]:
    """Returns ``(y, limit_residual)``."""
    y, residual = core.q_ombu_forward(float(x.reshape(-1)[0].detach()), params, config=config)
    return x.new_tensor(y), x.new_tensor(residual)
Other public import paths
  • omnibias.qcalculus.torch.q_ombu_forward
  • omnibias.qcalculus.torch.hybrid.q_ombu_forward
FUNCTION

worked_example​

omnibias.qcalculus.torch.hybrid.worked_exampleSource ↗
worked_example() -> dict[str, float]

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Returnsdict[str, float]
Regression example · g4 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_bit_identical() -> None:
    torch.set_default_dtype(torch.float64)
    assert torch_ex()["y"] == jax_ex()["y"]
    t_y, t_r = torch_fwd(torch.tensor(2.0))
    j_y, j_r = jax_fwd(jnp.asarray(2.0))
    assert float(t_y) == float(j_y)
    assert float(t_r) == float(j_r)
python -m pytest tests/test_q_ombu_parity.py -k test_g4_bit_identical -q
Read the implementation
def worked_example() -> dict[str, float]:
    return core.worked_example()