Skip to main content

ClikaRT::ops::leaky_relu

function

leaky_relu()

Tensor leaky_relu(Tensor x, double negative_slope = 0.01)

ReLU with a small slope on the negative side.

leaky_relu(x)={xx>0negative_slopexx0\mathrm{leaky\_relu}(x) = \begin{cases} x & x > 0 \\ \mathrm{negative\_slope}\cdot x & x \le 0 \end{cases}

Parameters

  • x: the input tensor.
  • negative_slope: the negative-side slope. Default 0.01.

Throws

  • ClikaRT::Error: when the input's dtype is not served for this operation (the machine-readable reason rides code_name()).

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

auto y = ClikaRT::ops::leaky_relu(x, 0.2);

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