Write a program to display a graph for ReLU (Rectified Linear Unit) function. ReLU function is defined as below:

y = max (0, x)
Consider the range of x from -5 to 5.

install the following package 

pip install matplotlib

Code

import matplotlib.pyplot as plt

def relu(x):
return max(0, x)

if __name__ == '__main__':
x = list(range(-5, 6))
y = [relu(i) for i in x]
plt.plot(x, y)
plt.show()

Output