torchfilter.utils._unscented_transform

Private module; avoid importing from directly.

Module Contents

Classes

UnscentedTransform

Helper class for performing (batched, differentiable) unscented transforms.

class torchfilter.utils._unscented_transform.UnscentedTransform(*, dim: int, sigma_point_strategy: SigmaPointStrategy = JulierSigmaPointStrategy())[source]

Helper class for performing (batched, differentiable) unscented transforms.

Keyword Arguments:
weights_c :torch.Tensor

Unscented transform covariance weights. Note that this will be initially instantiated on the CPU, and moved in compute_distribution().

Type:

torch.Tensor

weights_m :torch.Tensor

Unscented transform mean weights. Note that this will be initially instantiated on the CPU, and moved in compute_distribution().

Type:

torch.Tensor

select_sigma_points(self, input_mean: torch.Tensor, input_covariance: types.CovarianceTorch) torch.Tensor[source]

Select sigma points.

Parameters:
  • input_mean (torch.Tensor) – Distribution mean. Shape should be (N, dim).

  • input_covariance (torch.Tensor) – Distribution covariance. Shape should be (N, dim, dim).

Returns:

torch.Tensor – Selected sigma points, with shape (N, 2 * dim + 1, dim).

select_sigma_points_square_root(self, input_mean: torch.Tensor, input_scale_tril: types.ScaleTrilTorch) torch.Tensor[source]

Select sigma points using square root of covariance.

Parameters:
  • input_mean (torch.Tensor) – Distribution mean. Shape should be (N, dim).

  • input_scale_tril (torch.Tensor) – Cholesky decomposition of distribution covariance. Shape should be (N, dim, dim).

Returns:

torch.Tensor – Selected sigma points, with shape (N, 2 * dim + 1, dim).

compute_distribution(self, sigma_points: torch.Tensor) Tuple[torch.Tensor, types.CovarianceTorch][source]

Estimate a distribution from selected sigma points.

Parameters:

sigma_points (torch.Tensor) – Sigma points, with shape (N, 2 * dim + 1, dim).

Returns:

Tuple[torch.Tensor, torch.Tensor] – Mean and covariance, with shapes (N, dim) and (N, dim, dim) respectively.

compute_distribution_square_root(self, sigma_points: torch.Tensor, additive_noise_scale_tril: types.ScaleTrilTorch | None = None) Tuple[torch.Tensor, types.ScaleTrilTorch][source]

Estimate a distribution from selected sigma points; square root formulation.

Parameters:
  • sigma_points (torch.Tensor) – Sigma points, with shape (N, 2 * dim + 1, dim).

  • additive_noise_scale_tril (torch.Tensor, optional) – Parameterizes an additive Gaussian noise term. Should be lower-trinagular, with shape (N, dim, dim).

Returns:

Tuple[torch.Tensor, torch.Tensor] – Mean and square root of covariance, with shapes (N, dim) and (N, dim, dim) respectively.