mindspore/docs/api/api_python/mint/mindspore.mint.nn.functiona...

19 lines
1.1 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.functional.dropout
====================================
.. py:function:: mindspore.mint.nn.functional.dropout(input, p=0.5, training=True, inplace=False)
在训练期间,以服从伯努利分布的概率 `p` 随机将输入Tensor的某些值归零起到减少神经元相关性的作用避免过拟合。并且训练过程中返回值会乘以 :math:`\frac{1}{1-p}` 。在推理过程中,此层返回与 `input` 相同的Tensor。
参数:
- **input** (Tensor) - 输入Tensorshape为 :math:`(*, N)`
- **p** (float可选) - 输入神经元丢弃概率数值范围在0到1之间。例如 `p` =0.1删除10%的神经元。默认值: ``0.5``
- **training** (bool可选) - 若为 ``True`` 则启用dropout功能若为 ``False`` 则直接返回输入,并且 `p` 无效。默认值: ``True``
- **inplace** (bool可选) - 若为 ``True`` 则启用原地更新功能。默认值: ``False``
返回:
- **output** (Tensor) - 归零后的Tensorshape和数据类型与 `input` 相同。
异常:
- **TypeError** - `input` 不是Tensor。