mindspore.ops.PReLU

class mindspore.ops.PReLU[源代码]

带参数的线性修正单元激活函数(Parametric Rectified Linear Unit activation function)。

更多参考详见 mindspore.ops.prelu()

支持平台:

Ascend GPU

样例:

>>> class Net(nn.Cell):
...     def __init__(self):
...         super(Net, self).__init__()
...         self.prelu = ops.PReLU()
...     def construct(self, x, weight):
...         result = self.prelu(x, weight)
...         return result
...
>>> x = Tensor(np.arange(-6, 6).reshape((2, 3, 2)), mindspore.float32)
>>> weight = Tensor(np.array([0.1, 0.6, -0.3]), mindspore.float32)
>>> net = Net()
>>> output = net(x, weight)
>>> print(output)
[[[-0.60 -0.50]
  [-2.40 -1.80]
  [ 0.60  0.30]]
 [[ 0.00  1.00]
  [ 2.00  3.00]
  [ 4.0   5.00]]]