torchsig.utils.verify.verify_distribution_list

torchsig.utils.verify.verify_distribution_list(distro: list[float], required_length: int, distro_name: str, list_name: str) list[float][source]

Verifies and normalizes a given distribution list.

If the distribution list is None, it assumes a uniform distribution and returns it as is. If the distribution list is not of the required length or does not sum to 1.0, it raises an error or normalizes the list to sum to 1.0.

Parameters:
  • distro (List[float]) – The distribution list to verify. Can be None for a uniform distribution.

  • required_length (int) – The expected length of the distribution list.

  • distro_name (str) – The name of the distribution list (used for error messages).

  • list_name (str) – The name of the list this distribution corresponds to (used for error messages).

Returns:

The verified and possibly normalized distribution list.

Return type:

List[float]

Raises:

ValueError – If the distribution list is not of the required length or does not sum to 1.0 and cannot be normalized.