torch_blue.vi.VISequential

class torch_blue.vi.VISequential(*args: torch.nn.Module)
class VISequential(arg: OrderedDict[str, torch.nn.Module])

Bases: torch_blue.vi.base.VIModule, torch.nn.Sequential

Sequential container for VIModule.

Equivalent to nn.Sequential, that manages VIModule too. See its documentation for usage.

Detects and aggregates prior_log_prob and variational_log_prob from submodules, if needed. Then passes on only the output to the next module. This makes mixed sequences of VIModule and nn.Module work with and without return_log_probs.

forward(input_)

Forward pass that manages log probs, if required.

Parameters:

input (Varies) – Input for the first module in the stack. Passed on to it unchanged.

Returns:

output – Output of the module stack.

Return type:

Varies