Family Registry¶
Every distribution family is described once by a
FamilySpec, which records its parameter names,
support, output representation, and constructors, and is registered in
FAMILY_REGISTRY. The inline builders and
conditional families dispatch on the registered specification, so registering a family with
register_family, and refreshing the inline
tables with reload_inline_registry,
lets inline builders resolve its constructors. Checked QVR source must also
support its parameter contract, and each renderer needs its own mapping;
registration alone establishes neither capability. A specification separates
batch and event shapes
(Pyro Developers, n.d.-e): batch axes index independent distributions, and event axes belong to one
jointly scored outcome. QVR states these roles with the
over and iid_over options of a draw (event and batch axes).
family_spec
¶
Single source of truth for every parametric distribution family the quivers stack supports.
A FamilySpec carries everything the three call paths need:
- the conditional path
(
quivers.continuous.families._IndependentConditional) consumesparamsto know how to transform unbounded MLP outputs and how to instantiate atorch.distributionsobject; - the fixed inline path
(
quivers.continuous.inline.FixedDistribution) consumesparamsandsupportto construct a distribution from literal compile-time floats; - the mixed inline path
(
quivers.continuous.inline.MixedInlineDistribution) consumes the same spec to build a distribution whose parameters are stacked runtime tensors.
Every family registers itself exactly once via register; the
inline and conditional generators read from the same record. This
is the architectural seam that keeps the family catalog from
duplicating itself across three modules.
FAMILY_REGISTRY
module-attribute
¶
FAMILY_REGISTRY: dict[str, FamilySpec] = {}
Every registered family specification, keyed by its DSL name.
ParamKind
¶
Per-parameter shape contract on the inline call side.
"scalar"— broadcasts across the codomain's last axis (one parameter value per per-codomain dimension, as inNormal(loc, scale))."vector"— a single vector parameter for the whole sample (used byDirichletwhose concentration is the full simplex-dimensional vector, not a per-component scalar)."integer"— a count-typed parameter (total_countforBinomial/NegativeBinomial/Multinomial); the fixed-factory accepts a Pythonint.
OutputKind
¶
How the distribution's output relates to the codomain.
The conditional path reads output_kind to decide whether to use
the generic per-dim _IndependentConditional or a hand-written
class. The inline path reads it to pick the matching codomain
inference rule.
ParamSpec
didactic-model
¶
ParamSpec(*, name: str, transform: str | Bijector = field(opaque=True, extras=OPAQUE_BY_IDENTITY), kind: ParamKind = 'scalar', inline_bounds: tuple[float, float] | None = field(default=None, opaque=True, extras=OPAQUE_BY_VALUE))
Bases: ValueModel
Spec for a single parameter of a distribution family.
Parameter specifications compare by identity. Their transforms retain
live bijector references, and string transforms expose their registry
keys through transform_name. Field updates use with_.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Keyword argument expected by the underlying torch
TYPE:
|
transform |
Either a string key registered in
TYPE:
|
kind |
Per-parameter shape contract on the inline call side.
TYPE:
|
inline_bounds |
A closed interval for inline parameter validation, such as
the nonnegative domain of a Poisson
TYPE:
|
bijector
property
¶
bijector: Bijector
The resolved Bijector
for this parameter.
For a string-typed transform, looks the key up in
TRANSFORM_TO_BIJECTOR;
for a Bijector-typed transform, returns it unchanged.
raw_transform
property
¶
The bijector's forward map, exposed as a plain callable.
For callers that treat the transform as
Callable[[Tensor], Tensor].
inline_clamp
property
¶
Domain map for explicit literal or runtime parameters.
Valid positive values are preserved and nonpositive values
are refused. A declared inline_bounds interval preserves its
endpoints and refuses values outside that interval.
transform_name
property
¶
A stable string identifier for the transform.
Returns the registered key when transform is a string;
returns a synthesised name based on the bijector class for
Bijector-typed transforms.
FamilySpec
didactic-model
¶
FamilySpec(*, name: str, dist_class: type[Distribution] = field(opaque=True, extras=OPAQUE_BY_IDENTITY), params: tuple[ParamSpec, ...] = field(opaque=True, extras=OPAQUE_BY_VALUE), support: Constraint = field(opaque=True, extras=OPAQUE_BY_IDENTITY), discrete: bool = False, output_kind: OutputKind = 'independent', docstring: str = '', fixed_factory_override: Callable[..., ContinuousMorphism] | None = field(default=None, opaque=True, extras=OPAQUE_BY_IDENTITY), mixed_builder_override: Callable[[list[Tensor]], Distribution] | None = field(default=None, opaque=True, extras=OPAQUE_BY_IDENTITY), conditional_class_override: type | None = field(default=None, opaque=True, extras=OPAQUE_BY_IDENTITY))
Bases: ValueModel
Single source of truth for a distribution family.
Runtime classes, constraints, and builder callables retain their identities. Parameter specifications retain their identity within the ordered parameter tuple.
Used by:
quivers.continuous.families._IndependentConditionaland the standaloneConditionalXclasses for the learnable-parameter path;quivers.continuous.inline.FixedDistributionandquivers.continuous.inline.MixedInlineDistributionfor the DSL inline call surface.
dist_class
class-attribute
instance-attribute
¶
The underlying torch.distributions class.
params
class-attribute
instance-attribute
¶
params: tuple[ParamSpec, ...] = dx.field(opaque=True, extras=OPAQUE_BY_VALUE)
Ordered parameter specs, matching the dist's positional / keyword API.
support
class-attribute
instance-attribute
¶
support: Constraint = dx.field(opaque=True, extras=OPAQUE_BY_IDENTITY)
Output support, used by variational guides to pick a bijector.
discrete
class-attribute
instance-attribute
¶
True for integer / categorical outputs.
output_kind
class-attribute
instance-attribute
¶
output_kind: OutputKind = 'independent'
How the distribution's output relates to the codomain shape.
docstring
class-attribute
instance-attribute
¶
Used as the generated ConditionalX class docstring.
fixed_factory_override
class-attribute
instance-attribute
¶
fixed_factory_override: Callable[..., ContinuousMorphism] | None = dx.field(default=None, opaque=True, extras=OPAQUE_BY_IDENTITY)
Override for the all-literal FixedDistribution factory.
mixed_builder_override
class-attribute
instance-attribute
¶
mixed_builder_override: Callable[[list[Tensor]], Distribution] | None = dx.field(default=None, opaque=True, extras=OPAQUE_BY_IDENTITY)
Override for the mixed-mode dist builder
(list[Tensor]) -> Distribution.
conditional_class_override
class-attribute
instance-attribute
¶
conditional_class_override: type | None = dx.field(default=None, opaque=True, extras=OPAQUE_BY_IDENTITY)
Override for the conditional class (used by Categorical, Bernoulli, MultivariateNormal, etc.).
atomicity
property
¶
Read reference-measure classification from the semantic family record.
| RETURNS | DESCRIPTION |
|---|---|
str
|
Semantic atomicity, shared by native and reference runtimes. |
param_names
property
¶
Return parameter names in constructor order.
| RETURNS | DESCRIPTION |
|---|---|
tuple[str, ...]
|
Names shared by the inline and conditional constructors. |
register_family
¶
register_family(spec: FamilySpec) -> FamilySpec
Register a FamilySpec under its name; idempotent on
re-registration of the same name to support hot-reload during
development.
Source code in src/quivers/continuous/family_spec.py
get_family_spec
¶
get_family_spec(name: str) -> FamilySpec | None
family_names
¶
build_torch_distribution
¶
build_torch_distribution(spec: FamilySpec, params: list[Tensor] | dict[str, Tensor]) -> Distribution
Instantiate the underlying torch distribution from a list / dict of parameter tensors that have already been clamped to the family's constraints.
Source code in src/quivers/continuous/family_spec.py
clamp_param
¶
clamp_param(spec: FamilySpec, name: str, value: Tensor) -> Tensor
Apply the inline safety clamp for the named parameter of
spec.
Source code in src/quivers/continuous/family_spec.py
Cited sources¶
Pyro Developers. Tensor shapes in Pyro. Pyro Tutorials, version 1.9.1, n.d.-e. URL: https://pyro.ai/examples/tensor_shapes.html (visited on 2026-11-06).