Skip to content

Commit

Permalink
Update misc.py
Browse files Browse the repository at this point in the history
fix inplace operation (pytorch bug)
  • Loading branch information
louisoutin authored Dec 25, 2023
1 parent 341b34d commit 946fd37
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion deepdow/layers/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def compute_covariance(m, shrinkage_strategy=None, shrinkage_coef=0.5):
"""
fact = 1.0 / (m.size(1) - 1)
m -= torch.mean(m, dim=1, keepdim=True) # !!!!!!!!!!! INPLACE
m = m - torch.mean(m, dim=1, keepdim=True) # !!!!!!!!!!! INPLACE
mt = m.t()

s = fact * m.matmul(mt) # sample covariance matrix
Expand Down

0 comments on commit 946fd37

Please sign in to comment.