mlnext.utils.check_ndim#
- mlnext.utils.check_ndim(*arrays: ndarray, ndim: int, strict: bool = True)[source]#
Checks whether each passed array has exactly ndim number of dimensions, if strict is false then the number of dimensions must be at most ndim.
- Parameters:
ndim (int) – Number of dimensions.
strict (bool, optional) – If true ndim must match exactly, otherwise at most.
- Raises:
ValueError – Raised if an error does not match the ndim requirements.
Example
>>> mlnext.utils.check_ndim(np.ones((1, 2, 3)), np.ones((3, 2, 1)), ... ndim=3)