spd_learn.modules.PositiveDefiniteScalar#

class spd_learn.modules.PositiveDefiniteScalar(mapping='exp', device=None, dtype=None)[source]#

Bases: Module

Positive definite scalars parametrization.

This module projects real scalars onto the space of positive definite scalars by applying either the exponential or SoftPlus functions.

Parameters:
  • mapping (str, optional) – Mapping from real scalars to positive definite scalars. Default is “exp”. Options are: “exp” and “softplus”

  • device (torch.device, optional) – Device for the module. Default is None. Note: This parametrization class has no parameters or buffers, so device is accepted for API consistency but not used.

  • dtype (torch.dtype, optional) – Data type for the module. Default is None. Note: This parametrization class has no parameters or buffers, so dtype is accepted for API consistency but not used.

forward(s)[source]#

Forward pass projecting input onto positive definite scalars.

Parameters:

s (torch.Tensor of shape ()) – Real scalar

Returns:

Positive definite scalar

Return type:

torch.Tensor of shape ()

right_inverse(s)[source]#

Map from positive definite scalar onto real scalars.

Parameters:

s (torch.Tensor of shape ()) – Positive definite scalar

Returns:

Real scalar

Return type:

torch.Tensor of shape ()