用法:
mxnet.ndarray.op.L2Normalization(data=None, eps=_Null, mode=_Null, out=None, name=None, **kwargs)
out:- 此函數的輸出。
NDArray 或 NDArray 列表
參數:
返回:
返回類型:
使用 L2 範數對輸入數組進行歸一化。
對於一維 NDArray,它計算:
out = data / sqrt(sum(data ** 2) + eps)
對於N-D NDArray,如果輸入數組的形狀為 (N, N, ..., N),
使用
mode
=instance
,它通過 L2 範數對多維數組中的每個實例進行歸一化:for i in 0...N out[i,:,:,...,:] = data[i,:,:,...,:] / sqrt(sum(data[i,:,:,...,:] ** 2) + eps)
使用
mode
=channel
,它通過 L2 範數對數組中的每個通道進行歸一化:for i in 0...N out[:,i,:,...,:] = data[:,i,:,...,:] / sqrt(sum(data[:,i,:,...,:] ** 2) + eps)
使用
mode
=spatial
,它通過 L2 範數對數組中每個位置的跨通道範數進行歸一化:for dim in 2...N for i in 0...N out[.....,i,...] = take(out, indices=i, axis=dim) / sqrt(sum(take(out, indices=i, axis=dim) ** 2) + eps) -dim-
例子:
x = [[[1,2], [3,4]], [[2,2], [5,6]]] L2Normalization(x, mode='instance') =[[[ 0.18257418 0.36514837] [ 0.54772252 0.73029673]] [[ 0.24077171 0.24077171] [ 0.60192931 0.72231513]]] L2Normalization(x, mode='channel') =[[[ 0.31622776 0.44721359] [ 0.94868326 0.89442718]] [[ 0.37139067 0.31622776] [ 0.92847669 0.94868326]]] L2Normalization(x, mode='spatial') =[[[ 0.44721359 0.89442718] [ 0.60000002 0.80000001]] [[ 0.70710677 0.70710677] [ 0.6401844 0.76822126]]]
相關用法
- Python mxnet.ndarray.op.uniform用法及代碼示例
- Python mxnet.ndarray.op.sample_negative_binomial用法及代碼示例
- Python mxnet.ndarray.op.khatri_rao用法及代碼示例
- Python mxnet.ndarray.op.unravel_index用法及代碼示例
- Python mxnet.ndarray.op.slice_like用法及代碼示例
- Python mxnet.ndarray.op.softmax_cross_entropy用法及代碼示例
- Python mxnet.ndarray.op.round用法及代碼示例
- Python mxnet.ndarray.op.diag用法及代碼示例
- Python mxnet.ndarray.op.linalg_det用法及代碼示例
- Python mxnet.ndarray.op.sample_uniform用法及代碼示例
- Python mxnet.ndarray.op.sort用法及代碼示例
- Python mxnet.ndarray.op.linalg_potrf用法及代碼示例
- Python mxnet.ndarray.op.linalg_potri用法及代碼示例
- Python mxnet.ndarray.op.broadcast_minus用法及代碼示例
- Python mxnet.ndarray.op.take用法及代碼示例
- Python mxnet.ndarray.op.pad用法及代碼示例
- Python mxnet.ndarray.op.erfinv用法及代碼示例
- Python mxnet.ndarray.op.UpSampling用法及代碼示例
- Python mxnet.ndarray.op.Reshape用法及代碼示例
- Python mxnet.ndarray.op.sample_gamma用法及代碼示例
注:本文由純淨天空篩選整理自apache.org大神的英文原創作品 mxnet.ndarray.op.L2Normalization。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。