fix: missing activation func derivative + send error before update

This commit is contained in:
Lenoctambule
2026-03-29 08:23:15 +02:00
parent efd328e530
commit 09835e9afa
4 changed files with 88 additions and 44 deletions

View File

@@ -9,7 +9,9 @@ def softmax(v: np.ndarray) -> np.ndarray:
return exp_v / np.sum(exp_v)
def relu(x: np.ndarray) -> np.ndarray:
def relu(x: np.ndarray, derivative=False) -> np.ndarray:
if derivative:
return x > 0
return x * (x > 0)