use dot product for weights

This commit is contained in:
2025-12-17 20:05:36 +01:00
parent 6c02e3c229
commit b7f9bf66b0
+2 -2
View File
@@ -19,7 +19,7 @@ def cd_jens(v_states: np.ndarray, params: RbmParams, v_to_ph: Callable, h_to_pv:
h_states = sample(h_probs)
# Update weights (positive phase)
dw = np.vecmat(np.transpose(v_states), h_states)
dw = np.dot(np.transpose(v_states), h_states)
dbv = np.sum(v_states, 0)
dbh = np.sum(h_states, 0)
@@ -37,7 +37,7 @@ def cd_jens(v_states: np.ndarray, params: RbmParams, v_to_ph: Callable, h_to_pv:
h_probs = v_to_ph(v_probs)
# Update weights (negative phase)
dw -= np.vecmat(np.transpose(v_probs), h_probs)
dw -= np.dot(np.transpose(v_probs), h_probs)
dbv -= np.sum(v_probs, 0)
dbh -= np.sum(h_probs, 0)