ActivationMatrixSampler#

class sdm.prior.ActivationMatrixSampler(matrix_sampler: MatrixSampler, activation: Activation, normalize: bool = True)#

Bases: MatrixSampler

Sample a base matrix and apply a random activation.

Activation operates on flattened matrix entries before adding Gaussian noise of scale 1e-3.

Parameters:
  • matrix_sampler (MatrixSampler) – Base matrix sampler; use normalize=False for raw inputs.

  • activation (Activation) – Activation applied to flattened matrix entries.

  • normalize (bool) – Add small Gaussian noise and L2-normalize output 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