Connect via MCP →

Enter Calculation

Formula

Show calculation steps (1)
  1. Sampled x Values

    Sampled x Values: Leaky ReLU Activation Function Calculator

    Each point i (from 0) uses x = startX + i*stepX for the given number of points.

Advertisement

Results

Leaky ReLU at x = 3
3
f(x) = x if x > 0, else α·x
Number of points 101
α (leak slope) 0.01
First f(x) (at x = -4) -0.04
Last f(x) (at x = 1) 1
x f(x)
-4 -0.04
-3.95 -0.0395
-3.9 -0.039
-3.85 -0.0385
-3.8 -0.038
-3.75 -0.0375
-3.7 -0.037
-3.65 -0.0365
-3.6 -0.036
-3.55 -0.0355
-3.5 -0.035
-3.45 -0.0345
-3.4 -0.034
-3.35 -0.0335
-3.3 -0.033
-3.25 -0.0325
-3.2 -0.032
-3.15 -0.0315
-3.1 -0.031
-3.05 -0.0305
-3 -0.03
-2.95 -0.0295
-2.9 -0.029
-2.85 -0.0285
-2.8 -0.028
-2.75 -0.0275
-2.7 -0.027
-2.65 -0.0265
-2.6 -0.026
-2.55 -0.0255
-2.5 -0.025
-2.45 -0.0245
-2.4 -0.024
-2.35 -0.0235
-2.3 -0.023
-2.25 -0.0225
-2.2 -0.022
-2.15 -0.0215
-2.1 -0.021
-2.05 -0.0205
-2 -0.02
-1.95 -0.0195
-1.9 -0.019
-1.85 -0.0185
-1.8 -0.018
-1.75 -0.0175
-1.7 -0.017
-1.65 -0.0165
-1.6 -0.016
-1.55 -0.0155
-1.5 -0.015
-1.45 -0.0145
-1.4 -0.014
-1.35 -0.0135
-1.3 -0.013
-1.25 -0.0125
-1.2 -0.012
-1.15 -0.0115
-1.1 -0.011
-1.05 -0.0105
-1 -0.01
-0.95 -0.0095
-0.9 -0.009
-0.85 -0.0085
-0.8 -0.008
-0.75 -0.0075
-0.7 -0.007
-0.65 -0.0065
-0.6 -0.006
-0.55 -0.0055
-0.5 -0.005
-0.45 -0.0045
-0.4 -0.004
-0.35 -0.0035
-0.3 -0.003
-0.25 -0.0025
-0.2 -0.002
-0.15 -0.0015
-0.1 -0.001
-0.05 -0.0005
0 0
0.05 0.05
0.1 0.1
0.15 0.15
0.2 0.2
0.25 0.25
0.3 0.3
0.35 0.35
0.4 0.4
0.45 0.45
0.5 0.5
0.55 0.55
0.6 0.6
0.65 0.65
0.7 0.7
0.75 0.75
0.8 0.8
0.85 0.85
0.9 0.9
0.95 0.95
1 1

What is the Leaky ReLU activation function?

The Leaky ReLU (Leaky Rectified Linear Unit) is a popular activation function in deep neural networks. Like the standard ReLU it passes positive inputs straight through, but instead of flattening negative inputs to zero it gives them a small nonzero slope alpha. This keeps a small gradient flowing for negative pre-activations and helps avoid the "dying ReLU" problem, where neurons get stuck outputting zero and stop learning.

Graph of the Leaky ReLU activation function on x and y axes
The Leaky ReLU curve: a straight line through the origin with a small slope for negative inputs and unit slope for positive inputs.

The formula

For an input \(x\) and leak slope \(\alpha\), the output is

$$f(x) = \begin{cases} x & \text{if } x > 0 \\[0.5em] \alpha \cdot x & \text{if } x \le 0 \end{cases}$$

The default leak is \(\alpha = 0.01\). Two special cases are worth noting: \(\alpha = 0\) reproduces the standard ReLU (\(\max(0, x)\)), and \(\alpha = 1\) collapses the function to the identity line \(f(x) = x\).

How to use this calculator

Enter the initial x value, the step size between points, the number of points to generate, and the leak slope alpha. The tool builds the sequence

$$x_i = \text{startX} + i \cdot \text{stepX}, \quad i = 0, 1, \dots, \text{count} - 1$$

evaluates \(f\) at each point, and lists the \((x, f(x))\) pairs plus a plot of the curve. You can also type a single \(x\) value to get one direct evaluation of \(f(x)\).

Worked example

With \(\alpha = 0.01\): at \(x = -4\) the input is non-positive, so $$f = 0.01 \times (-4) = -0.04.$$ At \(x = 0\), \(f = 0\). At \(x = 3\) the input is positive, so \(f = 3\). Using the defaults (\(\text{startX} = -4\), \(\text{stepX} = 0.05\), \(\text{count} = 101\)), the sweep runs from \(x = -4\) (\(f = -0.04\)) up to \(x = +1.0\) (\(f = 1.0\)), crossing zero at the 81st point (\(i = 80\)).

FAQ

How does Leaky ReLU differ from ReLU? ReLU outputs exactly 0 for all negative inputs; Leaky ReLU outputs \(\alpha \cdot x\), a small negative value, preserving a gradient.

What is a good value for alpha? 0.01 is the common default. Variants like Parametric ReLU learn alpha during training.

Can alpha be negative? Mathematically yes, but it is unusual and not recommended for standard networks.

Last updated: