KernelMatrixSampler#

class sdm.prior.KernelMatrixSampler(num_centers: HP[int] | int, gamma: HP[float] | float, channels: int = 3, normalize: bool = True)#

Bases: MatrixSampler

Sample Laplace-kernel matrices between Gaussian-mixture anchor points.

Uses entries exp(-gamma * distance) with random signs.

Parameters:
  • num_centers (HP[int] | int) – Number of Gaussian-mixture centers.

  • gamma (HP[float] | float) – Inverse distance scale.

  • channels (int) – Dimensionality of the anchor points.

  • normalize (bool) – Add small Gaussian noise and L2-normalize rows.

sample(size: Size | tuple[int, ...], dtype: dtype, generator: Generator | None = None) → Tensor#

Sample random matrices.

Parameters:
  • size (Size | tuple[int, ...]) – Output shape [..., M, N] with M rows and N columns per matrix.

  • dtype (dtype) – Output dtype.

  • generator (Generator | None) – Pseudorandom generator.

Returns:

Random matrices with shape size.

Return type:

Tensor