multigeom.geometry.compute_fisher#
- multigeom.geometry.compute_fisher(image, encoder, sigma, top_k=50, device=None, validate=True)#
Compute the top-k eigenpairs of J(x) = (1/σ²) J_{f_φ}ᵀ J_{f_φ}.
Args: image: [1, 1, 64, 64] in [-1, 1] (canonical pipeline coords). encoder: f_φ — an nn.Module satisfying the contract of multigeom.encoders.contract (any user model), or one built by multigeom.encoders.build_encoder. The Jacobian is taken through the public forward; encoders that expose _to_backbone_input, backbone and readout (the reference encoders and the test mocks) use those directly. sigma: σ from the Gaussian observation model. top_k: number of eigenpairs to return. device: target device. Defaults to encoder’s parameter device. validate: check the encoder against the contract first (once per encoder object; any encoder that does not expose the reference-encoder internals). Raises EncoderContractError.
- Returns:
FisherOutput with eigenvalues [k] and eigenvectors [k, P=4096].
- Parameters:
image (torch.Tensor)
sigma (float)
top_k (int)
device (torch.device | None)
validate (bool)
- Return type: