Browse Source

update L1Regularizer annotation

tags/v1.2.0-rc1
“dangjiaqi1” 4 years ago
parent
commit
71417617a5
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      mindspore/nn/layer/basic.py

+ 4
- 1
mindspore/nn/layer/basic.py View File

@@ -37,11 +37,14 @@ __all__ = ['Dropout', 'Flatten', 'Dense', 'ClipByNorm', 'Norm', 'OneHot', 'Pad',




class L1Regularizer(Cell): class L1Regularizer(Cell):
"""
r"""
Apply l1 regularization to weights Apply l1 regularization to weights


l1 regularization makes weights sparsity l1 regularization makes weights sparsity


.. math::
\text{loss}=\lambda * \text{reduce_sum}(\text{abs}(\omega))

Note: Note:
scale(regularization factor) should be a number which greater than 0 scale(regularization factor) should be a number which greater than 0




Loading…
Cancel
Save