Skip to content

Instantly share code, notes, and snippets.

@SkalskiP
Created May 23, 2020 17:05
Show Gist options
  • Save SkalskiP/66b0581b8637508dd4e128a1f2cb2611 to your computer and use it in GitHub Desktop.
Save SkalskiP/66b0581b8637508dd4e128a1f2cb2611 to your computer and use it in GitHub Desktop.
Relu
def forward_pass(self, a_prev: np.array) -> np.array:
self._z = np.maximum(0, a_prev)
return self._z
def backward_pass(self, da_curr: np.array) -> np.array:
dz = np.array(da_curr, copy=True)
dz[self._z <= 0] = 0
return dz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment