用法:
mxnet.ndarray.random.normal(loc=0, scale=1, shape=_Null, dtype=_Null, ctx=None, out=None, **kwargs)
- loc:(
float
or
NDArray
,
optional
) - 分布的平均值(中心)。 - scale:(
float
or
NDArray
,
optional
) - 分布的標準偏差(分布或寬度)。 - shape:(
int
or
tuple of ints
,
optional
) - 要繪製的樣本數。如果形狀是,例如,(m, n)
和loc
和scale
是標量,輸出形狀將是(m, n)
.如果loc
和scale
是具有形狀的 NDArray,例如,(x, y)
,則輸出將具有形狀(x, y, m, n)
,其中m*n
為每個抽取樣本[loc, scale)
一對。 - dtype:(
{'float16'
,
'float32'
,
'float64'}
,
optional
) - 輸出樣本的數據類型。默認為‘float32’ - ctx:(mxnet.context.Context
,
optional
) - 輸出的設備上下文。默認為當前上下文。被覆蓋loc.context
當loc
是一個 NDArray。 - out:(
NDArray
,
optional
) - 將輸出存儲到現有的 NDArray。
- loc:(
dtype
類型的 NDArray。如果輸入shape
具有形狀,例如(m, n)
和loc
和scale
是標量,則輸出形狀將為(m, n)
。如果loc
和scale
是具有形狀的 NDArray,例如(x, y)
,則輸出將具有形狀(x, y, m, n)
,其中為每個[loc, scale)
對繪製m*n
樣本。
參數:
返回:
返回類型:
從正態(高斯)分布中抽取隨機樣本。
樣本根據由
loc
(均值)和scale
(標準差)參數化的正態分布分布。例子:
>>> mx.nd.random.normal(0, 1) [ 2.21220636] <NDArray 1 @cpu(0)> >>> mx.nd.random.normal(0, 1, ctx=mx.gpu(0)) [ 0.29253659] <NDArray 1 @gpu(0)> >>> mx.nd.random.normal(-1, 1, shape=(2,)) [-0.2259962 -0.51619542] <NDArray 2 @cpu(0)> >>> loc = mx.nd.array([1,2,3]) >>> scale = mx.nd.array([2,3,4]) >>> mx.nd.random.normal(loc, scale, shape=2) [[ 0.55912292 3.19566321] [ 1.91728961 2.47706747] [ 2.79666662 5.44254589]] <NDArray 3x2 @cpu(0)>
相關用法
- Python mxnet.ndarray.random.negative_binomial用法及代碼示例
- Python mxnet.ndarray.random.generalized_negative_binomial用法及代碼示例
- Python mxnet.ndarray.random.shuffle用法及代碼示例
- Python mxnet.ndarray.random.uniform用法及代碼示例
- Python mxnet.ndarray.random.randint用法及代碼示例
- Python mxnet.ndarray.random.randn用法及代碼示例
- Python mxnet.ndarray.random.multinomial用法及代碼示例
- Python mxnet.ndarray.random.gamma用法及代碼示例
- Python mxnet.ndarray.random.exponential用法及代碼示例
- Python mxnet.ndarray.random.poisson用法及代碼示例
- Python mxnet.ndarray.random_pdf_generalized_negative_binomial用法及代碼示例
- Python mxnet.ndarray.random_pdf_negative_binomial用法及代碼示例
- Python mxnet.ndarray.random_pdf_gamma用法及代碼示例
- Python mxnet.ndarray.random_pdf_normal用法及代碼示例
- Python mxnet.ndarray.random_pdf_poisson用法及代碼示例
- Python mxnet.ndarray.random_pdf_dirichlet用法及代碼示例
- Python mxnet.ndarray.random_pdf_exponential用法及代碼示例
- Python mxnet.ndarray.random_pdf_uniform用法及代碼示例
- Python mxnet.ndarray.ravel_multi_index用法及代碼示例
- Python mxnet.ndarray.round用法及代碼示例
注:本文由純淨天空篩選整理自apache.org大神的英文原創作品 mxnet.ndarray.random.normal。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。