torchadf.nn.functional.unflatten

torchadf.nn.functional.unflatten(in_mean, in_var, dim, unflattened_size, mode='diag')

Unflattens a dimension of the inputs over multiple dimensions.

Assumed Density Filtering (ADF) version of the reverse reshaping operation corresponding to flatten. The dimension to be unflattened and target shape refer to the first input (mean) Tensor. Respective dimensions for the second input (covariance) Tensor are inferred according to the covariance propagation mode. (For the full covariance mode this can be ambiguous if the number of leading “batch” dimensions is unknown, hence we assume that any dimensions before the specified unflatten dimension are batch dimensions.)

Parameters:
in_meantorch.Tensor

Input mean tensor.

in_vartorch.Tensor

Input (co-)variance tensor.

dimint

Dimension to unflatten.

unflattened_size: tuple of int

Shape into which the selected dimension should be unflattened.

mode{“diag”, “diagonal”, “lowrank”, “half”, “full”}, optional

Covariance propagation mode (Default “diag”).

Returns:
out_meantorch.Tensor

The reshaped mean tensor.

out_vartorch.Tensor

The reshaped (co-)variance tensor.