mindspore2022/docs/api/api_python/ops/mindspore.ops.Dropout.rst

28 lines
1.2 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.ops.Dropout
======================
.. py:class:: mindspore.ops.Dropout(keep_prob=0.5, Seed0=0, Seed1=0)
Dropout是一种正则化手段通过在训练中以 :math:`1 - keep\_prob` 的概率随机将神经元输出设置为0起到减少神经元相关性的作用避免过拟合。
**参数:**
- **keep_prob** (float) - 输入神经元保留概率数值范围在0到1之间。例如keep_prob=0.9删除10%的神经元。默认值0.5。
- **Seed0** (int) - 算子层的随机种子用于生成随机数。默认值0。
- **Seed1** (int) - 全局的随机种子和算子层的随机种子共同决定最终生成的随机数。默认值0。
**输入:**
- **x** (Tensor) - Dropout的输入任意维度的Tensor其数据类型为float16或float32。
**输出:**
- **output** (Tensor) - shape和数据类型与 `x` 相同。
- **mask** (Tensor) - shape与 `x` 相同。
**异常:**
- **TypeError** - `keep_prob` 不是float。
- **TypeError** - `Seed0``Seed1` 不是int。
- **TypeError** - `x` 的数据类型既不是float16也不是float32。
- **TypeError** - `x` 不是Tensor。