Skip to content

Commit bb0a70a

Browse files
Avoid subtle bugs with in-place ops on views
1 parent ee75561 commit bb0a70a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

metric_learn/lfda.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,8 @@ def fit(self, X, Y):
9393
tSb -= _sum_outer(X)/n - tSw
9494

9595
# symmetrize
96-
tSb += tSb.T
97-
tSb /= 2
98-
tSw += tSw.T
99-
tSw /= 2
96+
tSb = (tSb + tSb.T) / 2
97+
tSw = (tSw + tSw.T) / 2
10098

10199
if self.params['dim'] == d:
102100
vals, vecs = scipy.linalg.eigh(tSb, tSw)

0 commit comments

Comments
 (0)