ReduceParentMerger#

class sdm.prior.ReduceParentMerger(aggr: HP[str] | str)#

Bases: ParentMerger

Apply random_fn to each parent and reduce the outputs.

Parameters:

aggr (HP[str] | str) – Reduction over parents, such as sum, prod, amax, or logsumexp.

forward(parent_values: Sequence[Tensor], random_fn: RandomFunction, out_channels: int, generator: Generator | None = None) → Tensor#

Compute node values from parent values with random_fn.

Parameters:
  • parent_values (Sequence[Tensor]) – Parent values with shape [R, H] for rows and channels. Parents may have different numbers of channels.

  • random_fn (RandomFunction) – Random function applied to the parent values.

  • out_channels (int) – Number of output channels.

  • generator (Generator | None) – Pseudorandom generator.

Returns:

Node values with shape [R, out_channels].

Return type:

Tensor