RandomQuadratic#

class sdm.prior.RandomQuadratic(max_channels: int = 20, matrix_sampler: MatrixSampler | None = None)#

Bases: RandomFunction

Apply a random quadratic function.

Parameters:
  • max_channels (int) – Maximum number of input channels used in the quadratic form.

  • matrix_sampler (MatrixSampler | None) – Random matrix sampler. Defaults to GaussianMatrixSampler.

forward(x: Tensor, out_channels: int, generator: Generator | None = None) → Tensor#

Apply a sampled function to every row of x.

Parameters:
  • x (Tensor) – Input values with shape [R, H] for rows and channels.

  • out_channels (int) – Number of output channels.

  • generator (Generator | None) – Pseudorandom generator.

Returns:

Node values with shape [R, out_channels].

Return type:

Tensor