Skip to content

Instantly share code, notes, and snippets.

@SkalskiP
Last active May 30, 2020 17:21
Show Gist options
  • Save SkalskiP/90e723f989f302a9f668055c1eeb8521 to your computer and use it in GitHub Desktop.
Save SkalskiP/90e723f989f302a9f668055c1eeb8521 to your computer and use it in GitHub Desktop.
def forward_pass(self, a_prev: np.array) -> np.array:
self._a_prev = np.array(a_prev, copy=True)
return np.dot(a_prev, self._w.T) + self._b
def backward_pass(self, da_curr: np.array) -> np.array:
n = self._a_prev.shape[0]
self._dw = np.dot(da_curr.T, self._a_prev) / n
self._db = np.sum(da_curr, axis=0, keepdims=True) / n
return np.dot(da_curr, self._w)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment