用法:
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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。