refactor RnnModel: multi-unit delay training and unified vc interface

- Add batch_delay() to shift visible input per unit index
- Unify forward_step() to work with combined vc matrix
- Fix split() to always slice on axis=1
- Add index param to Entity for readable naming
- Rename test_xor.py to xor.py, replace Mat with np.array

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 16:29:36 +02:00
co-authored by Claude Sonnet 4.6
parent b20ea4edb6
commit f7ed8563d7
4 changed files with 56 additions and 34 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ def concat(v: np.ndarray, c: np.ndarray, axis=0) -> np.ndarray:
def split(vc: np.ndarray, h_size: int, axis=0) -> tuple[np.ndarray, np.ndarray]:
v_len = vc.shape[axis]-h_size
return vc[0:v_len], vc[v_len:]
return vc[:, 0:v_len], vc[:, v_len:]
def shift_right(m: np.ndarray, amount: int = 1) -> np.ndarray:
return np.hstack([np.zeros((m.shape[0], amount)), m[:, :-amount]])