How to implement the ReLU function in Numpy

后端 未结 9 1045
野性不改
野性不改 2020-12-02 09:53

I want to make a simple neural network which uses the ReLU function. Can someone give me a clue of how can I implement the function using numpy.

9条回答
  •  醉话见心
    2020-12-02 10:30

    You can do it in much easier way:

    def ReLU(x):
        return x * (x > 0)
    
    def dReLU(x):
        return 1. * (x > 0)
    

提交回复
热议问题