mars.tensor.random.standard_normal#
- mars.tensor.random.standard_normal(size=None, chunk_size=None, gpu=None, dtype=None)[源代码]#
Draw samples from a standard Normal distribution (mean=0, stdev=1).
- 参数
size (int or tuple of ints, optional) – Output shape. If the given shape is, e.g.,
(m, n, k)
, thenm * n * k
samples are drawn. Default is None, in which case a single value is returned.chunk_size (int or tuple of int or tuple of ints, optional) – Desired chunk size on each dimension
gpu (bool, optional) – Allocate the tensor on GPU if True, False as default
dtype (data-type, optional) – Data-type of the returned tensor.
- 返回
out – Drawn samples.
- 返回类型
float or Tensor
实际案例
>>> import mars.tensor as mt
>>> s = mt.random.standard_normal(8000) >>> s.execute() array([ 0.6888893 , 0.78096262, -0.89086505, ..., 0.49876311, #random -0.38672696, -0.4685006 ]) #random >>> s.shape (8000,) >>> s = mt.random.standard_normal(size=(3, 4, 2)) >>> s.shape (3, 4, 2)