CategoricalConverter#

class sdm.prior.CategoricalConverter#

Bases: ABC

Base class for converting latent channels to categorical columns.

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

Return category indices and slices passed to child nodes.

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

  • generator (Generator | None) – Pseudorandom generator.

Returns:

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

Return type:

tuple[Tensor, Tensor]