Skip to content

Neural Network Layers User Guide

Synthesis content for building hyperbolic networks — choosing among the 40+ layers, the boundary between Euclidean and hyperbolic computation, and the composition patterns that aren't obvious from any single layer's docstring.

For per-layer signatures, init defaults, and call semantics, see the NN Layers API reference.

The code examples on this page assume these imports:

import jax
import jax.numpy as jnp
from flax import nnx

from hyperbolix import LearnableCurvature
from hyperbolix.manifolds import Hyperboloid, Poincare
from hyperbolix.nn_layers import (
    FGGLinear,
    HRCLayerNorm,
    HTCLinear,
    HyperbolicSoftmaxAttention,
    HyperPPFeatureScaling,
    HypRegressionHyperboloid,
    HypRegressionPoincarePP,
    lorentz_residual,
)

rngs = nnx.Rngs(0)

Choosing a Layer

Three axes matter, in this order: which manifold, fully-hyperbolic vs. hybrid, and which speed/expressiveness trade-off within that family. The tables below collapse this into per-task decisions.

Linear / Fully Connected

Layer Manifold When to pick
HTCLinear Hyperboloid Default for hyperboloid FC — simple, robust, just works. Also supports cross-curvature (c_in != c_out) for Hypformer blocks; c_out defaults to c_in
FGGLinear Hyperboloid Advanced — ~3× faster than the FHNN layer in Klis et al., but init-sensitive. Defaults to the norm-preserving fan_out init (init_bias=0.0), which suits unnormalized stacks feeding a bounded projection; pass reset_params="eye", init_bias=0.5 for the reference (BatchNorm-regime) init. Use once you have a working HTC baseline
HypLinearHyperboloidPLFC Hyperboloid Deep hyperboloid networks — point-to-hyperplane Lorentz FC (PLFC, Shi et al. 2026), the Lorentz analog of the HNN++ formulation. Optional intrinsic gyro-bias via use_gyro_bias=True
HypLinearPoincarePP Poincaré Default for Poincaré FC — Euclidean-parameterized weights, works with optax.adam
HypLinearPoincare Poincaré Legacy Ganea 2018 — manifold-valued bias, requires riemannian_adam. Prefer PP
HypLinearPV Proper Velocity PV networks — Euclidean weights, He init
HypLinearPoincareBusemann / HypLinearHyperboloidBusemann Poincaré / Hyperboloid Busemann FC (Chen, Schölkopf & Sebe 2026) — point-to-horosphere scores; the Poincaré one takes input_space="tangent"
HypLinearHyperboloidFHNN / HypLinearHyperboloidFHCNN Hyperboloid Reproducing Chen et al. 2022 / Bdeir et al. 2023

Convolutional

Layer Manifold When to pick
HypConv2DHyperboloid Hyperboloid Default for hyperboloid conv — well-established HCat formulation, robust across configurations
HypConv2DHyperboloidILNN Hyperboloid Intrinsic Lorentz conv (Shi et al. 2026) — log-radius-preserving concatenation (LogCat) + PLFC channel mixing, origin padding, optional gyro-bias
HypConv2DHyperboloidFHNN Hyperboloid HCat conv following the FHNN paper formulation; reach for it when reproducing that paper
FGGConv2D Hyperboloid Advanced — HCat expressiveness with FGG's speed, but inherits FGG's init sensitivity
HypConv2DPoincare Poincaré Standard for Poincaré CNNs (no faster variant exists)
HypConv2DPV Proper Velocity PV CNNs — raw Euclidean patch concatenation, no β-scaling
LorentzConv2D Hyperboloid Legacy / benchmarking only — HRC-based hack kept for comparing against older code. Not recommended for new work

Regression / Classification Head

Layer When to pick
HypRegressionHyperboloid Default for hyperboloid classification — well-established MLR over Lorentzian hyperplanes, just works
FGGLorentzMLR FGG-style MLR head — pair with FGG linear stack if you've already adopted the FGG family
HypRegressionPoincarePP Default for Poincaré classification — HNN++ formulation
HypRegressionPV PV classification head — small std=1e-2 init
HypRegressionPoincare Legacy Ganea — prefer PP
HypRegressionPoincareBusemann / HypRegressionHyperboloidBusemann Busemann (point-to-horosphere) heads

Vector Quantization (Poincaré)

Layer When to pick
HypVQEmbeddingPoincare Explicit on-ball codebook with a geometric EMA update (GGBall, Bu et al. 2026). No Riemannian optimizer — the codebook is a buffer moved by ema_update (called after optimizer.update); only the commitment loss trains the encoder. Optional dead-code revival
HypVQMLRPoincare Codebook-free — quantization as Poincaré-MLR classification with Gumbel-Softmax. Plain optax.adam, reconstruction-only loss, deterministic argmax at eval (model.eval())

Both are quantizer bottlenecks: feed them encoder tangent features, add output.loss to your reconstruction loss, and decode output.quantized (returned as float32). See the VQ API reference.

Attention, Normalization, Positional Encoding

Use case Layer
Long sequences, linear-complexity attention HyperbolicLinearAttention (O(N))
Most geometrically faithful attention HyperbolicFullAttention (O(N²))
Softmax attention with hyperbolic queries/keys HyperbolicSoftmaxAttention
Language-model attention: low-rank latent keys/values, decoupled HOPE slice, causal/segment/padding masks (HELM) LorentzMLA. Aggregates values with the single-GEMM centroid by default (centroid_form="gemm", as HELM does); pass "variance" for short sequences or values far from the origin (numerical stability)
Feed-forward block of a language model: top-k mixture of experts, one curvature per expert (HELM-MiCE) LorentzMoE (with LorentzMoEGate, LorentzSwiGLU); balance with moe_sequence_balance_loss and update_bias
Token embedding on the hyperboloid LorentzEmbedding — a ManifoldParam table trained with riemannian_adam (parameterization="manifold"), or a Euclidean spatial table ("spatial"); c_out maps the output onto another sheet
Normalization between hyperboloid layers HRCLayerNorm, HRCRMSNorm, HRCBatchNorm
Normalization between Poincaré conv layers PoincareBatchNorm2D
Intrinsic batch norm (Hyperboloid, PV) HyperboloidGyroBatchNorm, ProperVelocityGyroBatchNorm
Per-sample radial norm (batch-free, RL) HyperboloidGyroRMSNorm, ProperVelocityGyroRMSNorm, PoincareGyroRMSNorm
Dropout on hyperboloid features HRCDropout
Residual connection (hyperboloid) LorentzResidual / lorentz_residual
Rotary positional encoding (hyperbolic) HyperbolicRoPE / hope
Learnable positional encoding (Hypformer-style) HypformerPositionalEncoding

Single best default

For a new hyperbolic classifier: HTCLinear → HRCLayerNorm → HTCLinear → HypRegressionHyperboloid on Hyperboloid at c=1.0. The HTC/HRC family is the most robust starting point — simple, well-tuned defaults, and converges across a wide range of configurations. Move to FGG only if you need the speedup and are willing to babysit the init.

Layer Families at a Glance

The families differ in what space the weights live in, which controls optimizer choice:

Family Weight space Optimizer Examples Role
HRC / HTC (Hypformer) Euclidean optax.adam HTCLinear, HRC*, normalization Robust starting family
HCat (Bdeir 2023) Euclidean optax.adam HypConv2DHyperboloid* Robust conv family
HNN++ (Shimizu 2020 / van Spengler 2023) Euclidean optax.adam Poincaré *PP layers; HypLinearHyperboloidPLFC is the hyperboloid analog Standard for Poincaré
PV (Chen et al. 2026) Euclidean optax.adam HypLinearPV, HypConv2DPV Use when you want PV's unconstrained \(\mathbb{R}^n\)
FGG (Klis et al. 2026) Euclidean optax.adam FGGLinear, FGGConv2D, FGGLorentzMLR Advanced — fast, but init-sensitive
Ganea (legacy) Bias on Poincaré, kernel Euclidean riemannian_adam HypLinearPoincare, HypRegressionPoincare Legacy — prefer PP

Bottom line: every layer keeps its kernel Euclidean, so plain optax.adam works for all of them except two cases. The legacy Ganea layers have a manifold-valued bias; prefer their PP equivalents. LorentzEmbedding with its default parameterization="manifold" stores its table on the hyperboloid; train it with riemannian_adam or pass parameterization="spatial". See the Riemannian Optimizers guide.

Channel Conventions

The single most common bug in layer construction is passing the wrong channel count — ambient (d+1) vs. spatial (d). The full table lives in the Manifolds guide; the short form:

  • Hyperboloid layers (FGGLinear, LorentzConv2D, HTCLinear, HypLinearHyperboloid*) take ambient (d+1) for their input channel arg. Exception: out_features of HTCLinear, the three attention layers and HypformerPositionalEncoding is spatial (d) — their output is out_features + 1 ambient.
  • HRC normalization (HRCLayerNorm, HRCBatchNorm, etc.) takes spatial (d).
  • Poincaré and PV layers take spatial (d) (no time component).

Example: a hyperboloid network with 32 latent spatial dims:

manifold = Hyperboloid(c=1.0)
fc1 = FGGLinear(in_features=33, out_features=33, rngs=rngs)   # ambient
norm = HRCLayerNorm(num_features=32, rngs=rngs)               # spatial
fc2 = FGGLinear(in_features=33, out_features=33, rngs=rngs)   # ambient

Initialization Scales

Standard Euclidean inits (He, Xavier) are too large for Poincaré and hyperboloid layers: they push the first-layer output toward the Poincaré boundary or far up the hyperboloid, where distances and gradients explode; the defaults below hold the per-layer gain near 1 instead. Each family ships with a hyperbolic-aware default — keep it unless you have a reason to change it.

Family Default init Rationale
FGGLinear / FGGConv2D fan_out, std=sqrt(1/out_spatial), bias 0.0, gain=1.0 Norm-preserving (‖z‖ ≈ gain·‖x_spatial‖) so deep unnormalized stacks don't saturate a bounded projection — a deliberate deviation from the Klis et al. BatchNorm-regime reference. Restore the reference with reset_params="eye"/"lorentz_kaiming" + init_bias=0.5
FGGLinear / FGGConv2D with use_weight_norm=True Column norm softplus(kernel_scale), kernel_scale = sqrt(1/(in+out)) (about 0.7) gain and the fan_out scale are normalized away; each output column's norm is softplus(kernel_scale). init_kernel_scale=s sets the column norm to s at init
HypConv2DHyperboloidILNN Fan-out normal std=sqrt(1/out_spatial) (kernel_init_std=None) Norm-preserving: the PLFC chain linearizes to y_spatial ≈ W @ u_spatial near the origin, and the fixed LogCat hands over the per-pixel spatial radius, so this holds gain ≈ 1. kernel_init_std=0.02 restores the Shi et al. 2026 regime bit-for-bit
HypConv2DHyperboloid Fan-in normal std=sqrt(1/((C-1)·k² + 1)), bias 0 (reset_params="fan_in"); (C-1)·k² + 1 is the ambient dimension of the HCat output for C input channels and kernel size k Keeps the spread of the spatial coordinates: it changes by a factor of 0.98 to 1.09 per layer, while the mean distance from the origin grows by 1.04 to 1.22 per layer (16 channels, 3×3 kernels, c = 1). reset_params="uniform" restores the previous default U(-0.02, 0.02), which shrank the spread by a factor of 0.13 to 0.14 per layer. The Bdeir et al. 2023 reference conv instead draws kernel and bias from U(-s, s) with s = sqrt(2/((C-1)·k²))
HypLinearHyperboloidPLFC Small normal std=0.02, gyro-bias zeros (Shi et al. 2026 PLFC reference init) kernel_init_std=1.0 recovers the old HNN++-style init (Shimizu et al. 2020)
HypLinearPoincare / HypLinearPoincarePP Fan-in normal std=1/sqrt(in_dim) Keeps row norms small so outputs stay away from the boundary
HypRegressionPoincare / HypRegressionPoincarePP Scaled normal std=(2·in·out)^{-0.5} (van Spengler 2023) Sibling-scaled: an unscaled N(0,1) kernel gives row norms ≈ sqrt(in_dim), which overwhelms the MLR output scaling
HypRegressionHyperboloid Scaled normal std=(2·in_spatial·out)^{-0.5} with in_spatial = in_dim - 1, bias N(0, 0.01²) The same scaling as the Poincaré MLR heads (van Spengler 2023), with the fan-in counted over the spatial dimensions, because the kernel lies in the tangent space at the origin
HTCLinear Fan-in uniform U(-√(3/in), √(3/in)) Norm-preserving (per-layer gain ≈ 1). The old U(-0.02, 0.02) froze depth-≥2 stacks (init_bound=0.02 restores it). The Hypformer reference bound 2√(3/(in+out)) assumes ReLU + LayerNorm between layers; pass it as init_bound to recover
HypLinearHyperboloidFHCNN Small uniform U(-0.02, 0.02) Keeps points near the apex [1/sqrt(c), 0, …] initially (matches the Bdeir et al. 2023 reference)
HypLinear*PV He init PV is unconstrained \(\mathbb{R}^n\); standard scales work
HypRegressionPV std=1e-2 MLR head: small scores at init

Don't override init with He/Xavier on hyperbolic layers

If you wrap a hyperbolic layer in code that re-initializes its parameters with a default Flax init, the first-layer outputs can land far from the origin and training diverges. Tune the init with the layer's own arguments (kernel_init_std, init_bound, reset_params, init_bias, init_kernel_scale).

Too small is as fatal as too large — and quieter

A too-small init doesn't NaN; it freezes. If a layer's per-layer gain std·√fan_in is below 1, stacking compounds the contraction as gain^depth, and pairwise output distances fall below the float32 resolution of the distance computation: the stack becomes a constant map with ≈0 gradients from step 0, and training silently never starts. See the numerical stability guide for the mechanism.

The Euclidean ↔ Hyperbolic Boundary

Most networks aren't fully hyperbolic. The question is where you cross the boundary between Euclidean and hyperbolic computation:

Pattern Boundary location Typical use case
Fully hyperbolic Inputs are already on-manifold (e.g. embedding table on Poincaré) Knowledge graph embeddings, hierarchy learning
Hyperbolic head After a Euclidean backbone (CNN/Transformer) → expmap_0 or constraint projection → hyperbolic classifier; a Poincaré PP or Busemann head takes the features directly with input_space="tangent" (Pattern 2) ImageNet-scale CNNs with hyperbolic MLR (van Spengler 2023)
Hyperbolic backbone At input via expmap_0 per-pixel, then fully-hyperbolic through to a Euclidean logits layer FullyHyperbolicCNN on MNIST
Hybrid (sandwiched) Euclidean stem → small Euclidean embed → expmap_0 → hyperbolic block → logmap_0 → Euclidean head When you want hyperbolic geometry only mid-network

The boundary lift itself is covered in the Manifolds guide (Pattern A vs B). For the hybrid case on Hyperboloid, HyperPPFeatureScaling is the canonical recipe to prepare Euclidean features before expmap_0:

from hyperbolix.nn_layers import HyperPPFeatureScaling

hyperboloid, c, feature_dim = Hyperboloid(), 1.0, 16
x_euclidean = jax.random.normal(jax.random.PRNGKey(0), (4, feature_dim))  # backbone output

scale = HyperPPFeatureScaling(dim=feature_dim, rngs=rngs)
x_euclidean = scale(x_euclidean, c)            # RMSNorm + activation + dim scaling
x_manifold = jax.vmap(lambda v: hyperboloid.expmap_0(
    jnp.concatenate([jnp.zeros(1), v]), c
))(x_euclidean)

Proper Velocity: when to use expmap_0 (and when not to)

PV points live in unconstrained \(\mathbb{R}^n\), so expmap_0 is a once-per-network entry, not a per-layer adapter:

Architecture Apply expmap_0 at input? Why
Fully hyperbolic PV (PV layers all the way through) ✅ Yes, once at the beginning Establishes the proper-velocity coordinate frame; downstream PV layers assume their inputs were lifted from Euclidean tangent vectors
Hybrid PV (Euclidean backbone → PV head, or Euclidean ↔ PV alternating) ❌ No — pass Euclidean features directly to PV layers PV layers accept any point of \(\mathbb{R}^n\), so Euclidean features are valid inputs; an expmap_0 is not needed

Composition Patterns

The HTC/HRC family is the most robust default — well-established, forgiving of init, and converges across a wide range of configurations.

class HTCClassifier(nnx.Module):
    def __init__(self, in_dim: int, hidden: int, num_classes: int, *, rngs: nnx.Rngs):
        # in_dim is AMBIENT (d+1); hidden is SPATIAL — HTCLinear.out_features
        # is the one exception to "Hyperboloid layers take ambient" (see
        # Channel Conventions above), so its output is ambient (hidden + 1)
        self.manifold = Hyperboloid(c=1.0)
        self.fc1 = HTCLinear(in_features=in_dim, out_features=hidden, rngs=rngs)
        self.norm = HRCLayerNorm(num_features=hidden, rngs=rngs)  # SPATIAL
        self.fc2 = HTCLinear(in_features=hidden + 1, out_features=hidden, rngs=rngs)
        self.head = HypRegressionHyperboloid(
            manifold_module=self.manifold,
            in_dim=hidden + 1, out_dim=num_classes, rngs=rngs,
        )

    def __call__(self, x_BAi: jax.Array, c: float = 1.0) -> jax.Array:
        h = self.fc1(x_BAi, c)
        h = self.norm(h, c)
        h = self.fc2(h, c)
        return self.head(h, c)  # (B, num_classes) Euclidean logits


model = HTCClassifier(in_dim=33, hidden=32, num_classes=10, rngs=rngs)
x_BAi = Hyperboloid().proj_batch(jnp.ones((4, 33)), 1.0)  # (4, 33) points
logits = model(x_BAi)                                     # (4, 10)

Pattern 2: Hybrid CNN backbone + Poincaré head

Pass the Euclidean features to the head as they are, with input_space="tangent", instead of lifting them with expmap_0 first. The head then scores the point expmap_0 would give, in closed form, without storing that point. A lifted float32 point stops at the ball's ceiling: a longer feature vector is scored as if it sat on the ceiling, with a zero radial gradient. The tangent path stays accurate past it; at \(\sqrt{c}\,\lVert v\rVert = 8\) the float32 error of the scores drops from 2.0e-1 to 1.5e-6 (see Tangent Inputs to the HNN++ and Busemann Layers). HypLinearPoincarePP, HypRegressionPoincareBusemann and HypLinearPoincareBusemann take the same flag. Keep the default input_space="manifold" when the input is already a ball point, such as the output of an earlier Poincaré layer. HypConv2DPoincare already defaults to input_space="tangent" and always returns tangent vectors, so a stack of these convs takes the tangent path without setting the flag.

from hyperbolix import LearnableCurvature

class HybridCNN(nnx.Module):
    def __init__(self, num_classes: int, *, rngs: nnx.Rngs):
        self.stem = nnx.Conv(3, 64, kernel_size=(3, 3), rngs=rngs)  # Euclidean
        self.pool = lambda x: jnp.mean(x, axis=(1, 2))               # GAP
        self.poincare = Poincare(c=0.1)
        self.curvature = LearnableCurvature(init_c=0.1)              # per van Spengler
        self.head = HypRegressionPoincarePP(
            manifold_module=self.poincare,
            in_dim=64, out_dim=num_classes, rngs=rngs,
            input_space="tangent",  # takes the Euclidean features, no expmap_0
        )

    def __call__(self, images: jax.Array) -> jax.Array:
        c = self.curvature()
        features = self.pool(jax.nn.relu(self.stem(images)))  # (B, 64) Euclidean
        return self.head(features, c)                          # (B, num_classes) logits


model = HybridCNN(num_classes=10, rngs=rngs)
logits = model(jnp.ones((2, 8, 8, 3)))  # (2, 10)

Pattern 3: Hyperbolic transformer block

class HypTransformerBlock(nnx.Module):
    def __init__(self, dim_ambient: int, n_heads: int, *, rngs: nnx.Rngs):
        d_spatial = dim_ambient - 1
        self.attn_norm = HRCLayerNorm(num_features=d_spatial, rngs=rngs)
        self.attn = HyperbolicSoftmaxAttention(
            in_features=dim_ambient, out_features=d_spatial, num_heads=n_heads, rngs=rngs,
        )
        self.mlp_norm = HRCLayerNorm(num_features=d_spatial, rngs=rngs)
        # HTCLinear.out_features is spatial: mlp_in returns 4 * d_spatial + 1 ambient
        self.mlp_in = HTCLinear(in_features=dim_ambient,
                                out_features=4 * d_spatial, rngs=rngs)
        self.mlp_out = HTCLinear(in_features=4 * d_spatial + 1,
                                 out_features=d_spatial, rngs=rngs)

    def __call__(self, x_BLAi: jax.Array, c: float) -> jax.Array:
        h = self.attn(self.attn_norm(x_BLAi, c), c)
        x_BLAi = lorentz_residual(x_BLAi, h, w_y=1.0, c=c)  # weighted Lorentzian midpoint
        h = self.mlp_out(self.mlp_in(self.mlp_norm(x_BLAi, c), c), c)
        return lorentz_residual(x_BLAi, h, w_y=1.0, c=c)


block = HypTransformerBlock(dim_ambient=9, n_heads=2, rngs=rngs)
x_BLAi = Hyperboloid().proj_batch(jnp.ones((2, 5, 9)), 1.0)  # (B=2, L=5, A=9) points
y_BLAi = block(x_BLAi, c=1.0)                                  # (2, 5, 9)

Pattern 3b: HELM-style decoder block

The block of HELM (He et al. 2025): pre-norm, latent attention, a mixture of curvature experts, and a Lorentzian residual after each. hidden is ambient, x_BSA has shape (B, S, hidden).

import math
from hyperbolix.nn_layers import HRCRMSNorm, LorentzMLA, LorentzMoE, LorentzResidual

class HELMBlock(nnx.Module):
    def __init__(self, hidden: int, *, rngs: nnx.Rngs):
        self.attn_norm = HRCRMSNorm(hidden - 1, rngs=rngs)              # SPATIAL
        self.attn = LorentzMLA(
            hidden, num_heads=8, kv_lora_rank=64, qk_nope_head_dim=32,
            qk_rope_head_dim=17, v_head_dim=33, rngs=rngs,              # rope/v dims are AMBIENT
        )
        self.moe_norm = HRCRMSNorm(hidden - 1, rngs=rngs)
        self.moe = LorentzMoE(hidden, inter_dim=512, num_routed=8, num_shared=1, top_k=2, rngs=rngs)
        # HELM-style residual: learnable softplus weight, fixed output scale sqrt(hidden)
        self.attn_res = LorentzResidual(scale=True, init_gamma=math.sqrt(hidden))
        self.moe_res = LorentzResidual(scale=True, init_gamma=math.sqrt(hidden))

    def __call__(self, x_BSA: jax.Array, c: float):
        h = self.attn(self.attn_norm(x_BSA, c, c), c)                   # causal by default
        x_BSA = self.attn_res(x_BSA, h, c=c)
        h, stats = self.moe(self.moe_norm(x_BSA, c, c), c)
        return self.moe_res(x_BSA, h, c=c), stats

Add moe_sequence_balance_loss(stats, alpha=1e-4) to the loss, and call block.moe.update_bias(stats.mask, speed) after each optimizer step (RoutingBias is not trained by gradient). The token table is a LorentzEmbedding(vocab, hidden, rngs=rngs, c=c); train it with riemannian_adam inside the same nnx.Optimizer as the Euclidean weights. The expert curvatures start at linspace(0.1, 2.0, E); expert_curvatures=[1.0] * E together with learnable_curvature=False reproduces the released HELM checkpoint.

Common Pitfalls

1. Wrong channel count (ambient vs. spatial)

By far the most common construction bug. If a hyperboloid layer raises an incomprehensible shape error during the first call, check whether you passed spatial dim (d) where it wanted ambient (d+1), or vice versa.

2. Leaving version_idx dynamic under JIT

Poincare.dist and dist_0 take a version_idx selecting between formulations. Keep it static under JIT, so only the selected variant compiles; see Static vs Dynamic Arguments.

3. Using a Euclidean Dropout / LayerNorm on hyperboloid points

A point on the hyperboloid satisfies \(\langle x, x \rangle_L = -1/c\) — elementwise zeroing or affine normalization breaks the constraint and produces silent NaNs downstream. Use the manifold-aware variants: HRCDropout, HRCLayerNorm, HRCRMSNorm, HRCBatchNorm. (Poincaré has its own PoincareBatchNorm2D for conv stacks.)

4. Forgetting to project the input

If you build a hyperboloid point by hand (e.g. constraint projection from a Euclidean backbone) and feed it to a hyperbolic layer, float32 drift can violate the Lorentz constraint after a few training steps. Cheap insurance:

hyperboloid, c = Hyperboloid(), 1.0
x_BAi = jnp.concatenate([jnp.ones((4, 1)), 0.1 * jnp.ones((4, 32))], axis=-1)  # hand-built, (4, 33)

x_BAi = jax.vmap(hyperboloid.proj, in_axes=(0, None))(x_BAi, c)
# ... feed into hyperbolic layers

proj is idempotent on valid points and adds negligible cost.

See Also