mindspore/docs/api/api_python/ops/mindspore.ops.func_dropout.rst

22 lines
1.2 KiB
ReStructuredText
Raw 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:function:: mindspore.ops.dropout(x, p=0.5, seed0=0, seed1=0)
在训练期间,以服从伯努利分布的概率 `p` 随机将输入Tensor的某些值归零起到减少神经元相关性的作用避免过拟合。
参数:
- **x** (Tensor) - dropout的输入任意维度的Tensor其数据类型为float16或float32。
- **p** (float可选) - 输入神经元丢弃概率数值范围在0到1之间。例如p=0.1删除10%的神经元。默认值0.5。
- **seed0** (int可选) - 算子层的随机种子用于生成随机数。默认值0。
- **seed1** (int可选) - 全局的随机种子和算子层的随机种子共同决定最终生成的随机数。默认值0。
返回:
- **output** (Tensor) - shape和数据类型与 `x` 相同。
- **mask** (Tensor) - shape与 `x` 相同。
异常:
- **TypeError** - `p` 不是float。
- **TypeError** - `seed0``seed1` 不是int。
- **TypeError** - `x` 的数据类型既不是float16也不是float32。
- **TypeError** - `x` 不是Tensor。