inro.models¶
The architectures of the model zoo, all re-exported at the top level (inro.SIREN, inro.InstantNGP, ...). FUTON has its own page.
MLP¶
mlp
¶
Multi-layer perceptrons with standard or custom hidden layers.
ReLULayer
¶
Linear projection followed by ReLU.
Parameters:
-
in_features(int) –Input width.
-
out_features(int) –Output width.
Shape
- Input:
(..., in_features). - Output:
(..., out_features).
Source code in inro/models/mlp.py
MLP
¶
MLP(in_features: int, out_features: int, hidden_features: int | None = None, hidden_layers: int = 2, activation: Callable[[Tensor], Tensor] | None = None, *, layer_class: type[Module] | None = None, output_activation: Callable[[Tensor], Tensor] | None = None, **layer_kwargs: Any)
MLP with standard or custom hidden layers and a linear output layer.
A standard hidden layer is a linear projection followed by activation; a custom
one is an instance of layer_class. Subclasses apply custom initialization after
super().__init__.
Parameters:
-
in_features(int) –Input width.
-
out_features(int) –Output width.
-
hidden_features(int | None, default:None) –Hidden width;
Noneusesin_features. -
hidden_layers(int, default:2) –Number of hidden layers.
-
activation(Callable[[Tensor], Tensor] | None, default:None) –Callable applied after each standard hidden layer;
Noneuses ReLU. A module instance is shared across the layers. -
layer_class(type[Module] | None, default:None) –Class of the custom hidden layers, built as
layer_class(in_width, out_width, **layer_kwargs). No other activation is applied. -
output_activation(Callable[[Tensor], Tensor] | None, default:None) –Callable applied to the output;
Noneuses the identity. -
**layer_kwargs(Any, default:{}) –Constructor arguments of the hidden layers only.
Raises:
-
ValueError–If
hidden_layers < 1, or ifactivationandlayer_classare both given.
Shape
- Input:
(..., in_features). - Output:
(..., out_features).
Examples:
>>> from inro import SineLayer
>>> model = MLP(2, 3, hidden_features=64, layer_class=SineLayer, omega=30.0)
>>> model(torch.rand(8, 2)).shape
torch.Size([8, 3])
Source code in inro/models/mlp.py
Random Fourier features¶
rff
¶
RFF: ReLU MLP with a random Fourier feature input encoding.
RFFEncoding
¶
Random Fourier feature encoding of RFF.
Computes \(\sin(2\pi \boldsymbol{B}\boldsymbol{x})\), then
\(\cos(2\pi \boldsymbol{B}\boldsymbol{x})\). The fixed buffer B of shape
(num_frequencies, C) has its entries drawn from
\(\mathcal{N}(0, \sigma^2)\) at construction.
Parameters:
-
in_features(int) –Number of coordinate axes
C. -
num_frequencies(int, default:256) –Number of random frequency vectors.
-
sigma(float, default:10.0) –Standard deviation of the frequencies.
Shape
- Input:
(..., C). - Output:
(..., 2 * num_frequencies).
Source code in inro/models/rff.py
RFF
¶
RFF(in_features: int, out_features: int, hidden_features: int, hidden_layers: int = 3, num_frequencies: int = 256, sigma: float = 10.0, output_activation: Callable[[Tensor], Tensor] | None = None)
ReLU MLP with random Fourier features.
Parameters:
-
in_features(int) –Number of coordinate axes
C. -
out_features(int) –Number of output channels
D. -
hidden_features(int) –Hidden width.
-
hidden_layers(int, default:3) –Number of hidden layers.
-
num_frequencies(int, default:256) –Number of random frequency vectors.
-
sigma(float, default:10.0) –Standard deviation of the frequencies.
-
output_activation(Callable[[Tensor], Tensor] | None, default:None) –Callable applied to the output;
Noneuses the identity.
Shape
- Input:
(..., C)coordinates in[-1, 1]. - Output:
(..., D).
References
Tancik et al., "Fourier Features Let Networks Learn High Frequency Functions in Low Dimensional Domains", NeurIPS 2020.
Source code in inro/models/rff.py
Positional encoding¶
pemlp
¶
PE-MLP: ReLU MLP with a NeRF-style positional encoding.
PositionalEncoding
¶
Positional encoding [x, sin(2**k * x), cos(2**k * x)] of PEMLP.
The bands are k = 0, ..., num_frequencies - 1, without the \(\pi\) of NeRF's
Eq. (4), and the buffer freqs holds 2**k. The input comes first, then all
sines, then all cosines; within each block, bands vary faster than coordinates.
Parameters:
-
in_features(int) –Number of coordinate axes
C. -
num_frequencies(int, default:10) –Number of frequency bands.
Shape
- Input:
(..., C). - Output:
(..., C * (2 * num_frequencies + 1)).
Source code in inro/models/pemlp.py
PEMLP
¶
PEMLP(in_features: int, out_features: int, hidden_features: int, hidden_layers: int = 3, num_frequencies: int = 10, output_activation: Callable[[Tensor], Tensor] | None = None)
ReLU MLP with a NeRF-style positional encoding.
Parameters:
-
in_features(int) –Number of coordinate axes
C. -
out_features(int) –Number of output channels
D. -
hidden_features(int) –Hidden width.
-
hidden_layers(int, default:3) –Number of hidden layers.
-
num_frequencies(int, default:10) –Number of frequency bands.
-
output_activation(Callable[[Tensor], Tensor] | None, default:None) –Callable applied to the output;
Noneuses the identity.
Shape
- Input:
(..., C)coordinates in[-1, 1]. - Output:
(..., D).
References
Mildenhall et al., "NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis", ECCV 2020.
Source code in inro/models/pemlp.py
SIREN¶
siren
¶
SIREN: coordinate MLP with sine activations.
SineLayer
¶
Sine layer sin(omega * linear(x)) of SIREN.
Parameters:
-
in_features(int) –Input width.
-
out_features(int) –Output width.
-
omega(float, default:30.0) –Frequency multiplier.
Shape
- Input:
(..., in_features). - Output:
(..., out_features).
Source code in inro/models/siren.py
SIREN
¶
SIREN(in_features: int, out_features: int, hidden_features: int, hidden_layers: int = 3, omega: float = 30.0, first_omega: float | None = None, output_activation: Callable[[Tensor], Tensor] | None = None)
Sinusoidal representation network.
An MLP with SineLayer hidden layers, a linear output layer and
SIREN weight initialization. Biases keep PyTorch's defaults.
Parameters:
-
in_features(int) –Number of coordinate axes
C. -
out_features(int) –Number of output channels
D. -
hidden_features(int) –Hidden width.
-
hidden_layers(int, default:3) –Number of hidden layers.
-
omega(float, default:30.0) –Frequency multiplier.
-
first_omega(float | None, default:None) –Frequency multiplier of the first layer alone, the one
inro.fresh_selectchooses;Noneusesomega. The later layers' initialization followsomega. -
output_activation(Callable[[Tensor], Tensor] | None, default:None) –Callable applied to the output;
Noneuses the identity.
Shape
- Input:
(..., C)coordinates in[-1, 1]. - Output:
(..., D).
References
Sitzmann et al., "Implicit Neural Representations with Periodic Activation Functions", NeurIPS 2020.
Source code in inro/models/siren.py
FreSh¶
fresh
¶
FreSh: a SIREN's first-layer frequency chosen from the signal's spectrum.
References
Kania et al., "FreSh: Frequency Shifting for Accelerated Neural Representation Learning", ICLR 2025.
fresh_spectrum
¶
Compute the spectrum FreSh compares, as a distribution.
As in the authors' code, the grid is first resized to a square or a cube of its
smallest side, at most 1024: bilinearly with antialiasing in 2D, trilinearly in
3D. The amplitudes of its discrete Fourier transform are summed over the channels,
and those of nonnegative frequencies along shells of equal index sum d.
Parameters:
-
signal(Tensor) –Values on a grid,
(H, W, channels)or(depth, H, W, channels). -
size(int, default:64) –Number of shells
d = 1, ..., size, which leave out the constant term, at most half the side after resizing.
Returns:
-
Tensor–The shells divided by their sum, a float32 tensor
(size,)that sums to one.
Raises:
-
ValueError–If the grid is neither 2D nor 3D, or
sizeis too large.
Source code in inro/models/fresh.py
fresh_distance
¶
Return the Wasserstein-1 distance of two spectra.
Parameters:
-
p(Tensor) –Spectrum
(n,)on the points0, ..., n - 1. -
q(Tensor) –Spectrum
(n,)on the same points.
Source code in inro/models/fresh.py
fresh_select
¶
fresh_select(targets: Sequence[Tensor], render: Callable[[float], Tensor], omegas: Sequence[float] = tuple(range(10, 201, 10)), size: int = 64, inits: int = 10, seed: int = 0) -> tuple[float, dict[float, float]]
Choose a SIREN's first-layer frequency with FreSh.
A candidate's score is the mean fresh_distance between the
fresh_spectrum of its i-th untrained output and that of
targets[i % len(targets)].
Parameters:
-
targets(Sequence[Tensor]) –Signal on its grid, as
fresh_spectrumtakes it, or several views or frames. -
render(Callable[[float], Tensor]) –Function that builds a new, untrained model whose first layer has the given frequency and returns its output on the signal's grid.
-
omegas(Sequence[float], default:tuple(range(10, 201, 10))) –Candidate frequencies.
-
size(int, default:64) –Number of spectrum shells compared.
-
inits(int, default:10) –Number of initializations averaged per candidate.
-
seed(int, default:0) –Seed of the global random state, set anew for every candidate.
Returns:
-
tuple[float, dict[float, float]]–The candidate of least score, the smaller one on a tie, and every candidate's score.
Examples:
>>> from inro import SIREN, create_coordinates
>>> x = create_coordinates((32, 32))
>>> omega, scores = fresh_select(
... [torch.rand(32, 32, 3)],
... lambda omega: SIREN(2, 3, 16, first_omega=omega)(x),
... omegas=(10, 20),
... size=8,
... inits=2,
... )
>>> omega in scores
True
Source code in inro/models/fresh.py
Gauss¶
gauss
¶
Gauss: coordinate MLP with Gaussian activations.
GaussLayer
¶
Gaussian layer exp(-(scale * linear(x))**2) of Gauss.
Parameters:
-
in_features(int) –Input width.
-
out_features(int) –Output width.
-
scale(float, default:10.0) –Inverse Gaussian width.
Shape
- Input:
(..., in_features). - Output:
(..., out_features).
Source code in inro/models/gauss.py
Gauss
¶
Gauss(in_features: int, out_features: int, hidden_features: int, hidden_layers: int = 3, scale: float = 10.0, output_activation: Callable[[Tensor], Tensor] | None = None)
Gaussian coordinate MLP.
An MLP with GaussLayer hidden layers, a linear output layer and
PyTorch's default initialization.
Parameters:
-
in_features(int) –Number of coordinate axes
C. -
out_features(int) –Number of output channels
D. -
hidden_features(int) –Hidden width.
-
hidden_layers(int, default:3) –Number of hidden layers.
-
scale(float, default:10.0) –Inverse Gaussian width.
-
output_activation(Callable[[Tensor], Tensor] | None, default:None) –Callable applied to the output;
Noneuses the identity.
Shape
- Input:
(..., C)coordinates in[-1, 1]. - Output:
(..., D).
References
Ramasinghe and Lucey, "Beyond Periodicity: Towards a Unifying Framework for Activations in Coordinate-MLPs", ECCV 2022.
Source code in inro/models/gauss.py
WIRE¶
wire
¶
WIRE: coordinate MLPs with Gabor wavelet activations (real and complex).
RealGaborLayer
¶
Real Gabor layer cos(omega * z1) * exp(-(scale * z2)**2).
A linear projection gives z1 and z2, with out_features channels each.
Parameters:
-
in_features(int) –Input width.
-
out_features(int) –Output width.
-
omega(float, default:20.0) –Frequency multiplier.
-
scale(float, default:10.0) –Inverse Gaussian width.
Shape
- Input:
(..., in_features). - Output:
(..., out_features).
Source code in inro/models/wire.py
ComplexGaborLayer
¶
ComplexGaborLayer(in_features: int, out_features: int, omega: float = 20.0, scale: float = 10.0, is_first: bool = False)
Complex Gabor layer exp(1j * omega * z - abs(scale * z)**2).
Here z = linear(x).
Parameters:
-
in_features(int) –Input width.
-
out_features(int) –Output width.
-
omega(float, default:20.0) –Frequency multiplier.
-
scale(float, default:10.0) –Inverse Gaussian width.
-
is_first(bool, default:False) –Whether to use real weights, for real inputs, rather than complex.
Shape
- Input:
(..., in_features), real ifis_first, else complex. - Output:
(..., out_features), complex.
Source code in inro/models/wire.py
RealWIRE
¶
RealWIRE(in_features: int, out_features: int, hidden_features: int, hidden_layers: int = 3, omega: float = 20.0, scale: float = 10.0, output_activation: Callable[[Tensor], Tensor] | None = None)
Real-valued variant of WIRE with RealGaborLayer hidden layers.
Uses a linear output layer and PyTorch's default initialization. Each hidden layer projects to twice the reduced width, to form its two wavelet terms.
Parameters:
-
in_features(int) –Number of coordinate axes
C. -
out_features(int) –Number of output channels
D. -
hidden_features(int) –Hidden width, divided by
sqrt(2)and rounded down. -
hidden_layers(int, default:3) –Number of hidden layers.
-
omega(float, default:20.0) –Frequency multiplier.
-
scale(float, default:10.0) –Inverse Gaussian width.
-
output_activation(Callable[[Tensor], Tensor] | None, default:None) –Callable applied to the output;
Noneuses the identity.
Shape
- Input:
(..., C)coordinates in[-1, 1]. - Output:
(..., D).
Source code in inro/models/wire.py
WIRE
¶
WIRE(in_features: int, out_features: int, hidden_features: int, hidden_layers: int = 3, omega: float = 20.0, scale: float = 10.0, output_activation: Callable[[Tensor], Tensor] | None = None)
Wavelet implicit neural representation with complex Gabor layers.
Uses ComplexGaborLayer hidden layers, the first with real weights, and a
complex linear output layer, all with PyTorch's default initialization. The real
part of the output goes through output_activation. Dividing the width keeps the
parameter count comparable to real-valued networks.
Parameters:
-
in_features(int) –Number of coordinate axes
C. -
out_features(int) –Number of output channels
D. -
hidden_features(int) –Hidden width, divided by
sqrt(2)and rounded down. -
hidden_layers(int, default:3) –Number of hidden layers.
-
omega(float, default:20.0) –Frequency multiplier.
-
scale(float, default:10.0) –Inverse Gaussian width.
-
output_activation(Callable[[Tensor], Tensor] | None, default:None) –Callable applied to the output;
Noneuses the identity.
Shape
- Input:
(..., C)coordinates in[-1, 1], real. - Output:
(..., D), real.
References
Saragadam et al., "WIRE: Wavelet Implicit Neural Representations", CVPR 2023.
Source code in inro/models/wire.py
FINER¶
finer
¶
FINER: coordinate MLP with variable-periodic sine activations.
FinerLayer
¶
Variable-periodic sine layer sin(omega * (abs(z) + 1) * z) of FINER.
Here z = linear(x). The scale abs(z) + 1 is detached, which keeps its
derivative out of the gradient.
Parameters:
-
in_features(int) –Input width.
-
out_features(int) –Output width.
-
omega(float, default:30.0) –Frequency multiplier.
Shape
- Input:
(..., in_features). - Output:
(..., out_features).
Source code in inro/models/finer.py
FINER
¶
FINER(in_features: int, out_features: int, hidden_features: int, hidden_layers: int = 3, omega: float = 30.0, output_activation: Callable[[Tensor], Tensor] | None = None)
Variable-periodic coordinate MLP.
An MLP with FinerLayer hidden layers, a linear output layer and
SIREN weight initialization. Biases keep PyTorch's defaults; the paper's enlarged
first-layer bias range is not exposed.
Parameters:
-
in_features(int) –Number of coordinate axes
C. -
out_features(int) –Number of output channels
D. -
hidden_features(int) –Hidden width.
-
hidden_layers(int, default:3) –Number of hidden layers.
-
omega(float, default:30.0) –Frequency multiplier.
-
output_activation(Callable[[Tensor], Tensor] | None, default:None) –Callable applied to the output;
Noneuses the identity.
Shape
- Input:
(..., C)coordinates in[-1, 1]. - Output:
(..., D).
References
Liu et al., "FINER: Flexible Spectral-bias Tuning in Implicit NEural Representation by Variable-periodic Activation Functions", CVPR 2024.
Source code in inro/models/finer.py
reset_parameters
¶
Multiplicative filter networks¶
mfn
¶
MFN: multiplicative filter network with Gabor filters.
GaborFilter
¶
GaborFilter(in_features: int, out_features: int, input_scale: float, alpha: float = 1.0, beta: float = 1.0)
Gabor filter sin(Wx + b) * exp(-gamma * ||x - mu||**2 / 2) of MFN.
The centers mu start uniformly in [-1, 1] and the inverse squared widths
gamma from a Gamma distribution, both learnable. The weights W are scaled by
input_scale * sqrt(gamma) and the biases b start in \([-\pi, \pi]\).
Parameters:
-
in_features(int) –Number of coordinate axes
C. -
out_features(int) –Number of filters.
-
input_scale(float) –Frequency scale.
-
alpha(float, default:1.0) –Gamma shape.
-
beta(float, default:1.0) –Gamma rate.
Shape
- Input:
(..., C), with at least one leading dimension. - Output:
(..., out_features).
Source code in inro/models/mfn.py
MFN
¶
MFN(in_features: int, out_features: int, hidden_features: int, hidden_layers: int = 4, input_scale: float = 256.0, weight_scale: float = 1.0, alpha: float = 6.0, beta: float = 1.0, output_activation: Callable[[Tensor], Tensor] | None = None)
Multiplicative Gabor filter network.
Each hidden layer multiplies a GaborFilter of the raw coordinates by a
linear transform of the previous hidden state; the first takes its filter alone. A
linear layer gives the output.
Parameters:
-
in_features(int) –Number of coordinate axes
C. -
out_features(int) –Number of output channels
D. -
hidden_features(int) –Hidden width.
-
hidden_layers(int, default:4) –Number of hidden layers, one filter each.
-
input_scale(float, default:256.0) –Frequency scale, divided by
sqrt(hidden_layers)per filter. -
weight_scale(float, default:1.0) –Scale of the hidden linear weights, drawn uniformly within
sqrt(weight_scale / hidden_features)of zero. -
alpha(float, default:6.0) –Gamma shape, divided by
hidden_layersper filter. -
beta(float, default:1.0) –Gamma rate.
-
output_activation(Callable[[Tensor], Tensor] | None, default:None) –Callable applied to the output;
Noneuses the identity.
Shape
- Input:
(..., C)coordinates in[-1, 1], with at least one leading dimension. - Output:
(..., D).
References
Fathony et al., "Multiplicative Filter Networks", ICLR 2021.
Source code in inro/models/mfn.py
Instant-NGP¶
instant_ngp
¶
Instant-NGP: a multiresolution hash encoding and an MLP, in pure PyTorch.
The encoding reproduces tiny-cuda-nn's HashGrid: level scales, half-cell offsets,
table sizes and the hash function match the reference, so equal table contents give
equal features. Only the storage layout of the concatenated table differs.
HashEncoding
¶
HashEncoding(in_features: int, num_levels: int = 16, features_per_level: int = 2, log2_hashmap_size: int = 19, base_resolution: int = 16, max_resolution: int = 2048)
Multiresolution hash encoding of InstantNGP.
Level l scales unit-cube positions by N_min * b**l - 1, with growth
b = (N_max / N_min) ** (1 / (L - 1)), and adds a half-cell offset that staggers
the levels (Appendix A of the paper). Its grid has ceil(scale) + 1 vertices per
axis, indexed densely when they fit in the table and hashed otherwise. The features
of the 2**C surrounding vertices are interpolated multilinearly and concatenated
across levels.
Parameters:
-
in_features(int) –Number of coordinate axes
C, from1to3. -
num_levels(int, default:16) –Number of resolution levels
L. -
features_per_level(int, default:2) –Feature channels
Fper table entry. -
log2_hashmap_size(int, default:19) –Base-2 logarithm of the maximum table entries per level.
-
base_resolution(int, default:16) –Coarsest resolution
N_min. -
max_resolution(int, default:2048) –Finest resolution
N_maxover[-1, 1]; the reference uses2048for NeRF and SDFs,max(H, W) / 2for images and the voxel resolution for volumes.
Attributes:
-
embeddings–Learnable tables of all levels, concatenated, that start uniformly in
[-1e-4, 1e-4].
Shape
- Input:
(..., C)coordinates in[-1, 1]. - Output:
(..., L * F).
Source code in inro/models/instant_ngp.py
out_features
property
¶
Number of output features, num_levels * features_per_level.
InstantNGP
¶
InstantNGP(in_features: int, out_features: int, num_levels: int = 16, features_per_level: int = 2, log2_hashmap_size: int = 19, base_resolution: int = 16, max_resolution: int = 2048, hidden_features: int = 64, hidden_layers: int = 1, output_activation: Callable[[Tensor], Tensor] | None = None)
Instant neural graphics primitive: a hash encoding and a bias-free ReLU MLP.
Mirrors tiny-cuda-nn's HashGrid followed by FullyFusedMLP, which has no
biases. The reference uses one 64-wide hidden layer for the NeRF density network and
two for images and SDFs.
Parameters:
-
in_features(int) –Number of coordinate axes
C, from1to3. -
out_features(int) –Number of output channels
D. -
num_levels(int, default:16) –Number of resolution levels
L. -
features_per_level(int, default:2) –Feature channels
Fper table entry. -
log2_hashmap_size(int, default:19) –Base-2 logarithm of the maximum table entries per level.
-
base_resolution(int, default:16) –Coarsest resolution
N_min. -
max_resolution(int, default:2048) –Finest resolution
N_maxover[-1, 1]; the reference uses2048for NeRF and SDFs,max(H, W) / 2for images and the voxel resolution for volumes. -
hidden_features(int, default:64) –Hidden width.
-
hidden_layers(int, default:1) –Number of hidden layers.
-
output_activation(Callable[[Tensor], Tensor] | None, default:None) –Callable applied to the output;
Noneuses the identity.
Shape
- Input:
(..., C)coordinates in[-1, 1]. - Output:
(..., D).
Note
The reference trains with Adam, betas=(0.9, 0.99) and eps=1e-15; the
tiny epsilon matters for rarely updated table entries.
References
Müller et al., "Instant Neural Graphics Primitives with a Multiresolution Hash Encoding", SIGGRAPH 2022.
Source code in inro/models/instant_ngp.py
Feature grids¶
multivector
¶
Learnable feature grids and expressions that combine lines, planes and volumes.
FeatureGrid
¶
Learnable feature grid with linear, bilinear or trilinear interpolation.
Coordinates span [-1, 1] with align_corners=True, and points outside read
the border.
Parameters:
-
features(int) –Feature channels at each grid vertex.
-
resolution(int | Sequence[int]) –Resolution per axis, an int for a 1D grid or a sequence of up to three. The order
(H, W)or(depth, H, W)is reversed against the coordinates: their first column indexesW, the secondHand the thirddepth.
Attributes:
-
grid–Learnable features
(1, features, *resolution), a 1D grid with a dummy height axis forgrid_sample.
Shape
- Input:
(N, C)coordinates in[-1, 1], or(N,)in 1D. - Output:
(N, features).
Examples:
>>> grid = FeatureGrid(features=8, resolution=(32, 64))
>>> grid(torch.rand(100, 2) * 2 - 1).shape
torch.Size([100, 8])
Source code in inro/models/multivector.py
reset_parameters
¶
MultiVector
¶
MultiVector(in_features: int, expr: str, features: int | Sequence[int], resolution: int | Sequence[int])
Learnable line, plane and volume grids combined by an expression.
Each atom samples a FeatureGrid at its coordinate columns, following the
grid decomposition of GA-Planes:
e1,e2,e3: lines along the first, second and third columns.e12,e13,e23: planes over the named pair of columns.e123: a volume over all three columns.o: elementwise product;+: elementwise sum.[term, term, ...]: channel concatenation.
Precedence is o > + > ,. Atoms on the third axis need in_features=3;
neither this nor the operands' widths are checked at construction.
Parameters:
-
in_features(int) –Number of coordinate axes
C,2or3. -
expr(str) –Expression that selects and combines the grids.
-
features(int | Sequence[int]) –Feature channels per grid: an int for all grids, or
(line, plane, volume)values, a short sequence repeating its last value. Operands ofoand+must have equal channel counts. -
resolution(int | Sequence[int]) –Resolution per axis per grid, given as
featuresis. Planes are square and volumes are cubic.
Attributes:
-
lines–Line grids keyed by atom name, or
Nonewhen unused. -
planes–Plane grids keyed by atom name, or
Nonewhen unused. -
volume–Volume grid, or
Nonewhen unused. -
features_per_term–Width of each top-level concatenated term, or one width when the expression is not bracketed.
Shape
- Input:
(N, C)coordinates in[-1, 1]. - Output:
(N, out_features).
Examples:
>>> model = MultiVector(2, "[e1 o e2, e12]", 8, (64, 16))
>>> model(torch.rand(100, 2) * 2 - 1).shape
torch.Size([100, 16])
References
Sivgin et al., "Geometric Algebra Planes: Convex Implicit Neural Volumes", ICML 2025.
Source code in inro/models/multivector.py
reset_parameters
¶
Re-initialize every grid's features from \(\mathcal{N}(0, 0.1^2)\).
GA-Planes¶
gaplanes
¶
GA-Planes: geometric algebra planes, feature grids with an MLP decoder.
GAPlanes
¶
GAPlanes(in_features: int, out_features: int, expr: str | None = None, features: int | Sequence[int] = 32, resolution: int | Sequence[int] = (256, 64, 16), hidden_features: int = 64, hidden_layers: int = 2, output_activation: Callable[[Tensor], Tensor] | None = None)
Line, plane and volume feature grids with a ReLU MLP decoder.
The default MultiVector expression combines a low-rank term with
lower-resolution grids: in 2D it concatenates the product of two line grids and a
plane; in 3D it also includes line-plane products and a volume.
Parameters:
-
in_features(int) –Number of coordinate axes
C,2or3. -
out_features(int) –Number of output channels
D. -
expr(str | None, default:None) –MultiVectorexpression;Noneselects all grids. -
features(int | Sequence[int], default:32) –Feature channels per grid: an int for all grids, or
(line, plane, volume)values, a short sequence repeating its last value. Operands ofoand+must have equal channel counts. -
resolution(int | Sequence[int], default:(256, 64, 16)) –Resolution per axis per grid, given as
featuresis. Planes are square and volumes are cubic. -
hidden_features(int, default:64) –Hidden width.
-
hidden_layers(int, default:2) –Number of hidden layers.
-
output_activation(Callable[[Tensor], Tensor] | None, default:None) –Callable applied to the output;
Noneuses the identity.
Shape
- Input:
(..., C)coordinates in[-1, 1]. - Output:
(..., D).
References
Sivgin et al., "Geometric Algebra Planes: Convex Implicit Neural Volumes", ICML 2025.
Source code in inro/models/gaplanes.py
TensoRF¶
tensorf
¶
TensoRF: tensor factorizations expressed as GA-Planes grid encodings.
TensoRF
¶
TensoRF(in_features: int, out_features: int, rank: int = 16, resolution: int = 128, mode: Literal['cp', 'vm'] = 'vm', hidden_features: int = 128, hidden_layers: int = 2, output_activation: Callable[[Tensor], Tensor] | None = None)
Tensor-factorized grid INR with a ReLU MLP decoder.
A GAPlanes model with one resolution and one feature count for all grids.
CP multiplies line grids into rank features; VM concatenates three line-plane
products into 3 * rank features.
Parameters:
-
in_features(int) –Number of coordinate axes
C,2or3. -
out_features(int) –Number of output channels
D. -
rank(int, default:16) –Feature channels per grid.
-
resolution(int, default:128) –Resolution per axis of each grid.
-
mode(Literal['cp', 'vm'], default:'vm') –Factorization,
"cp"or"vm";"vm"becomes"cp"in 2D. -
hidden_features(int, default:128) –Hidden width.
-
hidden_layers(int, default:2) –Number of hidden layers.
-
output_activation(Callable[[Tensor], Tensor] | None, default:None) –Callable applied to the output;
Noneuses the identity.
Shape
- Input:
(..., C)coordinates in[-1, 1]. - Output:
(..., D).
References
Chen et al., "TensoRF: Tensorial Radiance Fields", ECCV 2022.
Source code in inro/models/tensorf.py
F-INR¶
finr
¶
F-INR: a functional tensor decomposition, one SIREN per input axis.
FINR
¶
FINR(in_features: int, out_features: int, rank: int, hidden_features: int = 256, hidden_layers: int = 3, mode: str = 'cp', first_omega: float = 100.0, hidden_omega: float = 30.0, positional_encoding: int = 0, grid: bool = True, output_activation: Callable[[Tensor], Tensor] | None = None)
Functional tensor decomposition with one SIREN per coordinate axis.
Each axis's network maps its coordinate alone to factors, and a tensor format combines the axes' factors per output channel, with no decoder after it:
"cp": \(y_d = \sum_r \prod_c a_{c,dr}\), for anyC."tt": the tensor train \(y_d = \boldsymbol{u}_d^\top \boldsymbol{G}_d \boldsymbol{v}_d\), forC = 3, whoseR x Rcore comes from the first axis's network, as in the authors' code.
Each network has hidden_layers sine layers and a linear head.
Parameters:
-
in_features(int) –Number of coordinate axes
C. -
out_features(int) –Number of output channels
D. -
rank(int) –Rank
Rof the decomposition. -
hidden_features(int, default:256) –Hidden width.
-
hidden_layers(int, default:3) –Number of hidden layers.
-
mode(str, default:'cp') –Tensor format,
"cp", or"tt"forC = 3. -
first_omega(float, default:100.0) –Frequency multiplier of the first sine layer.
-
hidden_omega(float, default:30.0) –Frequency multiplier of the later sine layers.
-
positional_encoding(int, default:0) –Size
nof the authors'pos_enc, which replaces each network's raw coordinate bysin(2^k x)and thencos(2^k x)forkinrange(int(-(n - 1) / 2), int((n + 1) / 2)), son = 10gives the nine bands2^-4, ..., 2^4.0keeps the raw coordinate. -
grid(bool, default:True) –Whether to run each network once per distinct coordinate, when at most half of a batch's are distinct, and gather the factors per point; the output is the same. Turn it off for scattered points, such as a radiance field's samples, where finding the distinct ones only costs time.
-
output_activation(Callable[[Tensor], Tensor] | None, default:None) –Callable applied to the output;
Noneuses the identity.
Shape
- Input:
(..., C)coordinates in[-1, 1]. - Output:
(..., D).
References
Vemuri et al., "F-INR: Functional Tensor Decomposition for Implicit Neural Representations", WACV 2026.
Source code in inro/models/finr.py
reset_parameters
¶
Initialize as the authors' image code does, biases at zero.
Weights are drawn from U(-1/n, 1/n) in the first layer and from
U(-sqrt(6/n) / hidden_omega, sqrt(6/n) / hidden_omega) after it, for fan-in
n.
Source code in inro/models/finr.py
Grid INR¶
grid_inr
¶
Grid of independent implicit neural representations (INRs) with blended overlaps.
GridINR
¶
GridINR(inr_class: type[Module], in_features: int, out_features: int, patches_per_axis: int | Sequence[int] = 2, overlap: float = 0.25, **inr_kwargs: Any)
Independent coordinate networks on a regular grid of patches.
Coordinates in [-1, 1] are mapped to each patch's local [-1, 1] domain.
Overlapping patches blend their outputs with Hermite smoothstep weights, so up to
2**C networks contribute to each point.
Parameters:
-
inr_class(type[Module]) –Module class, built once per patch as
inr_class(in_features, out_features, **inr_kwargs). -
in_features(int) –Number of coordinate axes
C. -
out_features(int) –Number of output channels
D. -
patches_per_axis(int | Sequence[int], default:2) –Number of patches, shared or per axis.
-
overlap(float, default:0.25) –Fraction of a cell width added on each side of a patch.
0gives hard boundaries; values above0.5cause discontinuities. -
**inr_kwargs(Any, default:{}) –Keyword arguments of each patch network.
Attributes:
-
inrs–Patch networks in row-major order, the last axis varying fastest.
Shape
- Input:
(..., C)coordinates in[-1, 1]. - Output:
(..., D).
Examples:
>>> from inro import SIREN
>>> model = GridINR(SIREN, 2, 3, patches_per_axis=2, hidden_features=16)
>>> model(torch.rand(8, 2) * 2 - 1).shape
torch.Size([8, 3])
Source code in inro/models/grid_inr.py
Deep Image Prior¶
dip
¶
Deep Image Prior networks.
DIPSkip is the skip-connected encoder-decoder baseline and DIPUNet a
U-Net, both adapted from
https://github.com/DmitryUlyanov/deep-image-prior/tree/master/models.
References
Ulyanov et al., "Deep Image Prior", CVPR 2018.
DIPUNet
¶
DIPUNet(in_channels: int = 16, out_channels: int = 3, feature_scale: int = 4, norm_layer: Callable[[int], Module] | None = BatchNorm2d, upsample_mode: Literal['deconv', 'nearest', 'bilinear'] = 'bilinear', padding_mode: Literal['zeros', 'reflect'] = 'reflect', bias: bool = True, sigmoid_output: bool = True)
U-Net of Deep Image Prior, with four downsampling and upsampling stages.
Parameters:
-
in_channels(int, default:16) –Input noise channels; match the dataset's
noise_channels. -
out_channels(int, default:3) –Output channels.
-
feature_scale(int, default:4) –Divisor of the base widths
[64, 128, 256, 512, 1024]. -
norm_layer(Callable[[int], Module] | None, default:BatchNorm2d) –Normalization constructor of the input and encoder blocks;
Nonedisables it. Decoder blocks are unnormalized. -
upsample_mode(Literal['deconv', 'nearest', 'bilinear'], default:'bilinear') –Upsampling,
"deconv"for a transposed convolution, or"nearest"or"bilinear"for interpolation followed by a convolution. -
padding_mode(Literal['zeros', 'reflect'], default:'reflect') –Padding,
"zeros"or"reflect". -
bias(bool, default:True) –Whether to include convolution biases; transposed convolutions always do.
-
sigmoid_output(bool, default:True) –Whether to apply a sigmoid after the final convolution.
Shape
- Input:
(B, in_channels, H, W). - Output:
(B, out_channels, H', W'), with sides cropped to multiples of 16.
Source code in inro/models/dip.py
DIPSkip
¶
DIPSkip(in_channels: int = 32, out_channels: int = 3, down_channels: Sequence[int] = (128, 128, 128, 128, 128), up_channels: Sequence[int] = (128, 128, 128, 128, 128), skip_channels: Sequence[int] = (4, 4, 4, 4, 4), down_kernel_size: int | Sequence[int] = 3, up_kernel_size: int | Sequence[int] = 3, skip_kernel_size: int = 1, up_conv1x1: bool = True, upsample_mode: str | Sequence[str] = 'bilinear', padding_mode: Literal['zeros', 'reflect'] = 'reflect', bias: bool = True, sigmoid_output: bool = True)
Deep Image Prior encoder-decoder with a skip branch at each scale.
Strided convolutions downsample the input; the decoder upsamples and concatenates skip features, center-cropped at odd sizes. Hidden convolutions use BatchNorm and LeakyReLU(0.2).
Parameters:
-
in_channels(int, default:32) –Input noise channels; match the dataset's
noise_channels. -
out_channels(int, default:3) –Output channels.
-
down_channels(Sequence[int], default:(128, 128, 128, 128, 128)) –Encoder widths, one per scale.
-
up_channels(Sequence[int], default:(128, 128, 128, 128, 128)) –Decoder widths, one per scale.
-
skip_channels(Sequence[int], default:(4, 4, 4, 4, 4)) –Skip widths, one per scale; the three channel sequences must have equal length.
-
down_kernel_size(int | Sequence[int], default:3) –Encoder kernel size, shared or per scale.
-
up_kernel_size(int | Sequence[int], default:3) –Decoder kernel size, shared or per scale.
-
skip_kernel_size(int, default:1) –Skip convolution kernel size.
-
up_conv1x1(bool, default:True) –Whether to add a 1x1 convolution, BatchNorm and LeakyReLU block to each decoder.
-
upsample_mode(str | Sequence[str], default:'bilinear') –Interpolation mode, shared or per scale.
-
padding_mode(Literal['zeros', 'reflect'], default:'reflect') –Padding,
"zeros"or"reflect". -
bias(bool, default:True) –Whether to include convolution biases.
-
sigmoid_output(bool, default:True) –Whether to apply a sigmoid after the final convolution.
Shape
- Input:
(B, in_channels, H, W). - Output:
(B, out_channels, H, W); even kernel sizes shrink it.