-
-
Save cosmic-cortex/3d8c13f3013750239a558233748a9988 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Sigmoid(Function): | |
def forward(self, X): | |
return 1/(1 + np.exp(-X)) | |
def backward(self, dY): | |
return dY * self.grad['X'] | |
def local_grad(self, X): | |
s = 1/(1 + np.exp(-X)) | |
grads = {'X': s * (1 - s)} | |
return grads |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment