torchsig.utils.verify.verify_int

torchsig.utils.verify.verify_int(a: int, name: str, low: int = 0, high: int | None = None, clip_low: bool = False, clip_high: bool = False, exclude_low: bool = False, exclude_high: bool = False) int[source]

Verifies that the value a is an integer and within the specified bounds.

Parameters:
  • a (int) – The value to be checked.

  • name (str) – The name of the value to be used in error messages.

  • low (int, optional) – The lower bound of the value. Defaults to 0.

  • high (int, optional) – The upper bound of the value. Defaults to None.

  • clip_low (bool, optional) – If True, the value will be clipped to low if it is below low. Defaults to False.

  • clip_high (bool, optional) – If True, the value will be clipped to high if it exceeds high. Defaults to False.

  • exclude_low (bool, optional) – If True, a must be strictly greater than low. Defaults to False.

  • exclude_high (bool, optional) – If True, a must be strictly less than high. Defaults to False.

Raises:

ValueError – If a is not an integer or out of bounds.

Returns:

The verified integer value a.

Return type:

int