Last active
June 26, 2020 22:53
-
-
Save logancyang/c95ae9249e87c326f408f89a1695130a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Tensor: | |
def __init__(self, data, _parents, _op): | |
... | |
def sigmoid(self): | |
sigm = 1.0/(1 + np.exp(-self.data)) | |
out = Tensor(sigm, _parents=(self,), _op="σ") | |
def _backward(): | |
self.grad = sigm * (1 - sigm) | |
out._backward = _backward | |
return out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment