ray.data.from_numpy_refs#
- ray.data.from_numpy_refs(ndarrays: ObjectRef[numpy.ndarray] | List[ObjectRef[numpy.ndarray]]) MaterializedDataset [source]#
Creates a
Dataset
from a list of Ray object references to NumPy ndarrays.Examples
>>> import numpy as np >>> import ray >>> arr_ref = ray.put(np.array([1])) >>> ray.data.from_numpy_refs(arr_ref) MaterializedDataset(num_blocks=1, num_rows=1, schema={data: int64})
Create a Ray Dataset from a list of NumPy array references.
>>> ray.data.from_numpy_refs([arr_ref, arr_ref]) MaterializedDataset(num_blocks=2, num_rows=2, schema={data: int64})
- Parameters:
ndarrays – A Ray object reference to a NumPy ndarray or a list of Ray object references to NumPy ndarrays.
- Returns:
Dataset
holding data from the given ndarrays.
DeveloperAPI: This API may change across minor Ray releases.