ray.data.from_numpy#
- ray.data.from_numpy(ndarrays: numpy.ndarray | List[numpy.ndarray]) MaterializedDataset [source]#
Creates a
Dataset
from a list of NumPy ndarrays.Examples
>>> import numpy as np >>> import ray >>> arr = np.array([1]) >>> ray.data.from_numpy(arr) MaterializedDataset(num_blocks=1, num_rows=1, schema={data: int64})
Create a Ray Dataset from a list of NumPy arrays.
>>> ray.data.from_numpy([arr, arr]) MaterializedDataset(num_blocks=2, num_rows=2, schema={data: int64})
- Parameters:
ndarrays – A NumPy ndarray or a list of NumPy ndarrays.
- Returns:
Dataset
holding data from the given ndarrays.