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:
@@ -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]])
|
||||
|
||||
Reference in New Issue
Block a user