@staticmethod
PYL-R020127 def softmax(self, x):
28 return np.exp(x) / np.sum(np.exp(x), axis=0)
29
30 def leaky_relu(self, x):31 return np.where(x > 0, x, x * 0.01)
24 def relu(self, x):
25 return x * (x >= 0)
26
27 def softmax(self, x):28 return np.exp(x) / np.sum(np.exp(x), axis=0)
29
30 def leaky_relu(self, x):
21 net = self.softmax(net)
22 return net
23
24 def relu(self, x):25 return x * (x >= 0)
26
27 def softmax(self, x):
The method doesn't use its bound instance. Decorate this method with @staticmethod
decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.