use dot product for weights
This commit is contained in:
+2
-2
@@ -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)
|
h_states = sample(h_probs)
|
||||||
|
|
||||||
# Update weights (positive phase)
|
# 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)
|
dbv = np.sum(v_states, 0)
|
||||||
dbh = np.sum(h_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)
|
h_probs = v_to_ph(v_probs)
|
||||||
|
|
||||||
# Update weights (negative phase)
|
# 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)
|
dbv -= np.sum(v_probs, 0)
|
||||||
dbh -= np.sum(h_probs, 0)
|
dbh -= np.sum(h_probs, 0)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user