NumericalConverter#

class sdm.prior.NumericalConverter#

Bases: ABC

Base class for converting latent channels to numerical columns.

sample_num_channels(num_columns: int, generator: Generator | None = None) → Tensor#

Sample how many latent channels each numerical column reads.

Parameters:
  • num_columns (int) – Number of columns.

  • generator (Generator | None) – Pseudorandom generator.

Returns:

Integer channel counts with shape [C] for C columns. The default is one channel per column.

Return type:

Tensor

abstractmethod forward(slices: Tensor, generator: Generator | None = None) → tuple[Tensor, Tensor]#

Return numerical column values and slices passed to child nodes.

Parameters:
  • slices (Tensor) – Node-channel slices per column with shape [C, H, R] for columns, channels, and rows. The channel count H may be ragged across columns.

  • generator (Generator | None) – Pseudorandom generator.

Returns:

Column values with shape [C, R] and updated node-channel slices with the input shape for use by child nodes.

Return type:

tuple[Tensor, Tensor]