dataeval.utils.arrays.flatten_samples

dataeval.utils.arrays.flatten_samples(array: torch.Tensor) torch.Tensor
dataeval.utils.arrays.flatten_samples(array: dataeval.protocols.SequenceLike[Any]) numpy.typing.NDArray[Any]

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

Parameters:
array : ArrayLike

Input array with shape (N, …)

Returns:

Flattened array with shape (N, -1)

Return type:

np.ndarray or torch.Tensor

Raises:

TypeError – If array type is not supported