Skip to content

Commit

Permalink
Debug dsm.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kostrykin committed Jul 16, 2024
1 parent 5d251b2 commit 57a7536
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion superdsm/dsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,9 @@ def grad(self, params):
grad = np.sum([term1 * q for q in self.q], axis=1)
term1_sparse = coo_matrix(term1).transpose(copy=False)
if self.smooth_mat.shape[1] > 0:
grad2 = (np.ones((1, np.prod(self.w.shape))) @ self.smooth_mat.multiply(term1_sparse)).reshape(-1)
#grad2 = (np.ones((1, np.prod(self.w.shape))) @ self.smooth_mat.multiply(term1_sparse)).reshape(-1)
#grad2 = self.smooth_mat.multiply(term1_sparse).sum(axis=0).reshape(-1)
grad2 = self.smooth_mat.multiply(term1_sparse).sum(axis=0).reshape(-1)
assert np.allclose(
(np.ones((1, np.prod(self.w.shape))) @ self.smooth_mat.multiply(term1_sparse)).reshape(-1),
self.smooth_mat.multiply(term1_sparse).sum(axis=0).reshape(-1)
Expand Down

0 comments on commit 57a7536

Please sign in to comment.