dataeval.utils.arrays

Utility functions for array conversion and manipulation across different frameworks.

Functions

as_numpy(array, *[, dtype, required_ndim, required_shape])

Converts an ArrayLike to Numpy array without copying (if possible).

ensure_embeddings(…)

Validates the embeddings array and converts it to the specified type.

flatten_samples(…)

Flattens input array from (N, ...) to (N, -1) where all samples N have all data in their last dimension.

opt_as_numpy(array, *[, dtype, required_ndim, ...])

Converts an ArrayLike to Numpy array without copying (if possible), returns None if input is None.

opt_to_numpy(array, *[, dtype, required_ndim, ...])

Converts an ArrayLike to Numpy array, returns None if input is None.

rescale_array(…)

Rescale an array to the range [0, 1].

to_numpy(array, *[, dtype, required_ndim, ...])

Converts an ArrayLike to new Numpy array.