DeepCORAL icon indicating copy to clipboard operation
DeepCORAL copied to clipboard

I think you have a error.

Open typhoon1104 opened this issue 5 years ago • 2 comments

DEEP_CORAL_LOSS: def CORAL(source, target): d = source.data.shape[1] ns = source.data.shape[0] nt = target.data.shape[0]

# source covariance
xm = torch.mean(source, 0, keepdim=True) - source
xc = (xm.t() @ xm) / (ns-1)

# target covariance
xmt = torch.mean(target, 0, keepdim=True) - target
xct = xmt.t() @ xmt / (nt-1)

print(xc, xct)

# frobenius norm between source and target
loss = torch.sum(torch.mul((xc - xct), (xc - xct)))
loss = loss/(4*d*d)
return loss

typhoon1104 avatar Jun 23 '20 10:06 typhoon1104

I don't understand this part, too. Do you have some idea?

ZhouWenjun2019 avatar Apr 17 '21 12:04 ZhouWenjun2019

tldr, no error, this code is "correct". See my answer for this issue .

ch-andrei avatar Jun 02 '22 23:06 ch-andrei