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

28 lines
1.3 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.Dropout2D
=======================
.. py:class:: mindspore.ops.Dropout2D(keep_prob=0.5)
在训练期间,根据概率 :math:`1-keep\_prob` 随机地将一些通道设置为0且服从伯努利分布。对于shape为 :math:`(N, C, H, W)` 的四维Tensor通道特征图指的是shape为 :math:`(H, W)` 的二维特征图。)
Dropout2D 可以提高通道特征图之间的独立性。
.. note::
保持概率 :math:`keep\_prob` 等于 :func:`mindspore.ops.dropout2d` 中的 :math:`1 - p`
参数:
- **keep_prob** (float可选) - 输入通道保留率数值范围在0到1之间例如 `keep_prob` = 0.8意味着过滤20%的通道。默认值: ``0.5``
输入:
- **x** (Tensor) - shape为 :math:`(N, C, H, W)` 的四维张量其中N是批次大小C是通道数H是特征高度W是特征宽度。
输出:
- **output** (Tensor) - shape和数据类型与 `x` 相同。
- **mask** (Tensor) - shape与 `x` 相同数据类型为bool。
异常:
- **TypeError** - `x` 不是Tensor。
- **TypeError** - `keep_prob` 的数据类型不是float。
- **ValueError** - `keep_prob` 值不在 `[0.01.0]` 之间。
- **ValueError** - `x` 的维度不等于4。