Esempio n. 1
0
 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,
     )
Esempio n. 2
0
 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)
Esempio n. 3
0
 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)