prelu

dragon.nn.prelu(
  inputs,
  channel_shared=False,
  data_format='NCHW',
  **kwargs
)[source]

Apply the parametric rectified linear unit. [He et.al, 2015].

The PReLU function is defined as:

\[\text{PReLU}(x) = \begin{cases} x, & \text{ if } x \geq 0 \\ weight * x, & \text{ otherwise } \end{cases} \]

Examples:

x = dragon.constant([[-1, 0, 1]], 'float32')
w = dragon.fill([3], value=0.25, dtype='float32')
print(dragon.nn.prelu([x, w]))
Parameters:
  • inputs (Sequence[dragon.Tensor]) – The input and weight.
  • channel_shared (bool, optional, default=False.) – Whether to share the weight across channels.
  • data_format ({'NCHW', 'NHWC'}, optional) – The data format.
Returns:

dragon.Tensor – The output tensor.