python/ray/data/read_api.py
def from_numpy_refs(
    ndarrays: Union[ObjectRef[np.ndarray], List[ObjectRef[np.ndarray]]],
) -> Dataset[ArrowRow]:
    """Create a dataset from a list of NumPy ndarray futures.

    Args:
        ndarrays: A Ray object reference to a NumPy ndarray or a list of Ray object
            references to NumPy ndarrays.

    Returns:
        Dataset holding the given ndarrays.
    """
    if isinstance(ndarrays, ray.ObjectRef):
        ndarrays = [ndarrays]
    elif isinstance(ndarrays, list):
        for ndarray in ndarrays:
            if not isinstance(ndarray, ray.ObjectRef):
                raise ValueError(
                    "Expected list of Ray object refs, "
                    f"got list containing {type(ndarray)}"
                )
    else:
        raise ValueError(
            f"Expected Ray object ref or list of Ray object refs, got {type(ndarray)}"
        )

    ndarray_to_block = cached_remote_fn(_ndarray_to_block, num_returns=2)

    res = [ndarray_to_block.remote(ndarray) for ndarray in ndarrays]
    blocks, metadata = zip(*res)
    return Dataset(
        ExecutionPlan(
            BlockList(blocks, ray.get(list(metadata))),
            DatasetStats(stages={"from_numpy": metadata}, parent=None),
        ),
        0,
        False,
    )
Create a dataset from a list of NumPy ndarray futures.

    Args:
        ndarrays: A Ray object reference to a NumPy ndarray or a list of Ray object
            references to NumPy ndarrays.

    Returns:
        Dataset holding the given ndarrays.
    
Create a dataset from a list of NumPy ndarray futures.
Create a dataset from a list of NumPy ndarray futures .
def from_numpy_refs(
    ndarrays: Union[ObjectRef[np.ndarray], List[ObjectRef[np.ndarray]]],
) -> Dataset[ArrowRow]:
    if isinstance(ndarrays, ray.ObjectRef):
        ndarrays = [ndarrays]
    elif isinstance(ndarrays, list):
        for ndarray in ndarrays:
            if not isinstance(ndarray, ray.ObjectRef):
                raise ValueError(
                    "Expected list of Ray object refs, "
                    f"got list containing {type(ndarray)}"
                )
    else:
        raise ValueError(
            f"Expected Ray object ref or list of Ray object refs, got {type(ndarray)}"
        )
    ndarray_to_block = cached_remote_fn(_ndarray_to_block, num_returns=2)
    res = [ndarray_to_block.remote(ndarray) for ndarray in ndarrays]
    blocks, metadata = zip(*res)
    return Dataset(
        ExecutionPlan(
            BlockList(blocks, ray.get(list(metadata))),
            DatasetStats(stages={"from_numpy": metadata}, parent=None),
        ),
        0,
        False,
    )
def from_numpy_refs ( ndarrays : Union [ ObjectRef [ np . ndarray ] , List [ ObjectRef [ np . ndarray ] ] ] , ) -> Dataset [ ArrowRow ] : if isinstance ( ndarrays , ray . ObjectRef ) : ndarrays = [ ndarrays ] elif isinstance ( ndarrays , list ) : for ndarray in ndarrays : if not isinstance ( ndarray , ray . ObjectRef ) : raise ValueError ( "Expected list of Ray object refs, " f"got list containing {type(ndarray)}" ) else : raise ValueError ( f"Expected Ray object ref or list of Ray object refs, got {type(ndarray)}" ) ndarray_to_block = cached_remote_fn ( _ndarray_to_block , num_returns = 2 ) res = [ ndarray_to_block . remote ( ndarray ) for ndarray in ndarrays ] blocks , metadata = zip ( * res ) return Dataset ( ExecutionPlan ( BlockList ( blocks , ray . get ( list ( metadata ) ) ) , DatasetStats ( stages = { "from_numpy" : metadata } , parent = None ) , ) , 0 , False , )
Create a dataset from a list of NumPy ndarray futures.
Create a dataset from a list of NumPy ndarray futures .
"""Create a dataset from a list of NumPy ndarray futures.

    Args:
        ndarrays: A Ray object reference to a NumPy ndarray or a list of Ray object
            references to NumPy ndarrays.

    Returns:
        Dataset holding the given ndarrays.
    """
Dataset holding the given ndarrays.
Dataset holding the given ndarrays .
ndarrays
Union[ObjectRef[np.ndarray], List[ObjectRef[np.ndarray]]]
A Ray object reference to a NumPy ndarray or a list of Ray object
references to NumPy ndarrays.
A Ray object reference to a NumPy ndarray or a list of Ray object references to NumPy ndarrays .