RandomDiscretization#

class sdm.prior.RandomDiscretization(num_centers: HP[int] | int, p: HP[float] | float, linear: RandomLinear | None = None)#

Bases: RandomFunction

Replace each row with a linear transformation of its nearest center.

Parameters:
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