Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions objectives.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ def loss(self, H1, H2):

if self.use_all_singular_values:
# all singular values are used to calculate the correlation
tmp = torch.matmul(Tval.t(), Tval)
corr = torch.trace(torch.sqrt(tmp))
tmp = torch.diag(torch.matmul(Tval.t(), Tval))
tmp = torch.where(tmp>eps, tmp, (torch.ones(tmp.shape).double()*eps).to(self.device))
corr = torch.sum(torch.sqrt(tmp))
# assert torch.isnan(corr).item() == 0
else:
# just the top self.outdim_size singular values are used
Expand Down