def ones(cls, executor, shape, chunks, dtype=float, intermediate_store=None): dag = DAG(executor) input = dag.add_input(list(get_chunk_sizes(shape, chunks))) input = dag.transform(lambda chunk: np.ones(chunk, dtype=dtype), [input]) return cls( executor, dag, input, shape, chunks, dtype, intermediate_store=intermediate_store, )
def ones(cls, sc, shape, chunks, dtype=float): chunk_sizes = list(get_chunk_sizes(shape, chunks)) rdd = sc.parallelize(chunk_sizes, len(chunk_sizes)).map( lambda chunk: np.ones(chunk, dtype=dtype) ) return cls(sc, rdd, shape, chunks, dtype)
def ones(cls, shape, chunks, dtype=float): local_rows = [ np.ones(chunk, dtype=dtype) for chunk in get_chunk_sizes(shape, chunks) ] return cls(local_rows, shape, chunks, dtype)