less than 1 minute read

ReLU by Numpy

ReLU

Image


Code

np.clip(array, min, max)


Example

array = np.array([[1, 2, -3],
              [2.5, -0.2, 6]])
output = np.clip(array, 0, None)
array([[1. , 2. , 0. ],
       [2.5, 0. , 6. ]])

Leave a comment