mindspore/docs/api/api_python/mint/mindspore.mint.nn.Dropout.rst

28 lines
1.5 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.mint.nn.Dropout
=========================
.. py:class:: mindspore.mint.nn.Dropout(p=0.5, inplace=False)
随机丢弃层。
Dropout是一种正则化手段通过阻止神经元节点间的相关性来减少过拟合。该操作根据丢弃概率 `p` 在训练过程中随机将一些神经元输出设置为0。并且训练过程中返回值会乘以 :math:`\frac{1}{1-p}` 。在推理过程中,此层返回与输入 `input` 相同的Tensor。
论文 `Dropout: A Simple Way to Prevent Neural Networks from Overfitting <http://www.cs.toronto.edu/~rsalakhu/papers/srivastava14a.pdf>`_ 中提出了该技术,并证明其能有效地减少过度拟合,防止神经元共适应。更多详细信息,请参见 `Improving neural networks by preventing co-adaptation of feature detectors <https://arxiv.org/pdf/1207.0580.pdf>`_
.. note::
- 训练过程中,每步对同一通道(或神经元)独立进行丢弃。
- `p` 表示输入Tensor中元素设置成0的概率。
参数:
- **p** (float可选) - 输入神经元丢弃概率。例如, `p` =0.9即删除90%的神经元。默认值: ``0.5``
- **inplace** (bool可选) - 是否启用原地更新功能。若为 ``True`` ,则启用原地更新功能。默认值: ``False``
输入:
- **input** (Tensor) - Dropout的输入。
输出:
Tensor输出为Tensor其shape与 `input` 的 shape相同。
异常:
- **TypeError** - `inplace` 数据类型不是bool。