multigeom.geometry.compute_g#
- multigeom.geometry.compute_g = <function conditional_pair_estimate>#
Compute top-k eigenpairs of G(x) for a single image via the conditional-pair estimator (Algorithm 1).
Args: image: [1, 1, 64, 64] in [-1, 1] (canonical pipeline input). encoder: f_φ — built by multigeom.encoders.build_encoder. Must accept [B, 1, 64, 64] in [-1, 1] and return [B, n_neurons]. unet: trained NeuralConditionedUNet (ε_θ). alphas_cumprod: scheduler.alphas_cumprod, shape [T] on device. cfg: estimator config namespace (see configs/estimator.yaml). device: torch device. generator: optional torch.Generator on device for all Monte-Carlo draws (z, ξ_1, ξ_2). Stage 4 seeds one per image so each image’s estimate is reproducible on its own. validate: check the encoder against the contract of multigeom.encoders.contract first (it runs the encoder a few times, so mocks that record their calls should leave this off). Raises EncoderContractError. Off by default here; the Fisher baseline validates by default.
- Returns:
EstimatorOutput with eigenvalues [k] and eigenvectors [k, 4096].
- Parameters:
image (torch.Tensor)
unet (NeuralConditionedUNet)
alphas_cumprod (torch.Tensor)
device (torch.device)
generator (torch.Generator | None)
validate (bool)
- Return type: