Files
ray/lib/python/arrays/dist/random.py
T
2016-06-03 18:32:57 -07:00

18 lines
470 B
Python

from typing import List
import numpy as np
import arrays.single as single
import halo
from core import *
@halo.distributed([List[int]], [DistArray])
def normal(shape):
num_blocks = DistArray.compute_num_blocks(shape)
objrefs = np.empty(num_blocks, dtype=object)
for index in np.ndindex(*num_blocks):
objrefs[index] = single.random.normal(DistArray.compute_block_shape(index, shape))
result = DistArray()
result.construct(shape, objrefs)
return result