autosim.validation#

Validation and conversion helpers for simulator inputs and outputs.

class ValidationMixin[source]#

Bases: object

Mixin class for validation methods.

static check_vector(x)[source]#

Validate that the input is a 1D TensorLike.

Parameters:

x (Tensor)

Return type:

Tensor

static check_tensor_is_2d(x)[source]#

Validate that the input is a 2D TensorLike.

Parameters:

x (Tensor)

Return type:

Tensor

static check_pair(x, y)[source]#

Validate that two tensors have the same number of rows.

Parameters:
Return type:

tuple[Tensor, Tensor]

static check_covariance(y, Sigma)[source]#

Validate and return the covariance matrix.

Parameters:
Return type:

Tensor

static trace(Sigma, d)[source]#

Compute the trace of the covariance matrix.

Parameters:
Return type:

Tensor

static logdet(Sigma, dim)[source]#

Compute the log-determinant of the covariance matrix.

Parameters:
Return type:

Tensor

static max_eigval(Sigma)[source]#

Compute the maximum eigenvalue of the covariance matrix.

Parameters:

Sigma (Tensor)

Return type:

Tensor

set_random_seed(seed=42, deterministic=True)[source]#

Set random seed for Python, NumPy and PyTorch.

Parameters: