torchsig.utils.verify.verify_float¶
- torchsig.utils.verify.verify_float(f: float, name: str, low: float = 0.0, high: float | None = None, clip_low: bool = False, clip_high: bool = False, exclude_low: bool = False, exclude_high: bool = False) float[source]¶
Verifies that the value f is a float and within the specified bounds.
- Parameters:
f (float) – The value to be checked.
name (str) – The name of the value to be used in error messages.
low (float, optional) – The lower bound of the value. Defaults to 0.0.
high (float, 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, f must be strictly greater than low. Defaults to False.
exclude_high (bool, optional) – If True, f must be strictly less than high. Defaults to False.
- Raises:
ValueError – If f is not a float or out of bounds.
- Returns:
The verified float value f.
- Return type: