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
| def forward_pass(self, a_prev: np.array, training: bool) -> np.array: | |
| if training: | |
| self._mask = (np.random.rand(*a_prev.shape) < self._keep_prob) | |
| return self._apply_mask(a_prev, self._mask) | |
| else: | |
| return a_prev | |
| def backward_pass(self, da_curr: np.array) -> np.array: | |
| return self._apply_mask(da_curr, self._mask) |
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
| def forward_pass(self, a_prev: np.array) -> np.array: | |
| self._shape = a_prev.shape | |
| return np.ravel(a_prev).reshape(a_prev.shape[0], -1) | |
| def backward_pass(self, da_curr: np.array) -> np.array: | |
| return da_curr.reshape(self._shape) |
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
| 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 |
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
| fmpeg -i source-video.mp4 -r 1 -an -f image2 "frames/frame-%05d.jpg" |
OlderNewer