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

35 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.prelu
===================
.. py:function:: mindspore.ops.prelu(input, weight)
带参数的线性修正单元激活函数Parametric Rectified Linear Unit activation function
`Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification <https://arxiv.org/abs/1502.01852>`_ 描述了PReLU激活函数。定义如下
.. math::
prelu(x_i)= \max(0, x_i) + \min(0, w * x_i),
其中 :math:`x_i` 是输入的一个通道的一个元素,:math:`w` 是通道权重。
PReLU函数图
.. image:: ../images/PReLU2.png
:align: center
.. note::
- 通道数是输入的第二个维度值。当输入的维度小于2时则没有通道维度此时通道数等于1。
- 在GE模式下输入tensor的秩必须大于1否则会触发报错。
参数:
- **input** (Tensor) - 激活函数的输入Tensor。
- **weight** (Tensor) - 权重Tensor。其大小为1或者等于输入Tensor `input` 的通道数。
返回:
Tensor其shape和数据类型与 `input` 相同。
有关详细信息,请参考 :class:`mindspore.mint.nn.PReLU`
异常:
- **TypeError** - `input``weight` 不是Tensor。
- **ValueError** - `weight` 不是0-D或1-D Tensor。