Skip to main content

ClikaRT::ops::prelu

function

prelu()

Tensor prelu(Tensor x, OptionalTensor weight = {})

Parametric ReLU: a learned negative-side slope.

prelu(x)={xx>0wxx0\mathrm{prelu}(x) = \begin{cases} x & x > 0 \\ w \cdot x & x \le 0 \end{cases}

weight is a scalar or a per-channel tensor broadcast against x.

Parameters

  • x: the input tensor.
  • weight: the negative-slope tensor (scalar or per-channel). Absent uses the weight held by the bound primitive (module usage).

Throws

  • ClikaRT::Error: when weight's shape does not broadcast against x, or when the dtype is not served (code_name() carries the reason).

Returns: a new tensor, same shape and dtype as x.

auto y = ClikaRT::ops::prelu(x, slopes); // slopes: [C] or scalar

Declared in ClikaRT/compute/ops.h, line 951