Raincoat
Raincoat copied to clipboard
Questions about the correct module
In the correct function in algorithms/RAINCOAT.py
, src_y
in the incoming arguments is not called, and the correct process is no different from the update training process.
def correct(self, src_x, src_y, trg_x):
self.coptimizer.zero_grad()
src_feat, out_s = self.feature_extractor(src_x)
trg_feat, out_t = self.feature_extractor(trg_x)
src_recon = self.decoder(src_feat, out_s)
trg_recon = self.decoder(trg_feat, out_t)
recons = 1e-4 * (self.recons(trg_recon, trg_x) + self.recons(src_recon, src_x))
recons.backward()
self.coptimizer.step()
return {'recon': recons.item()}
I'm not quite sure how this code achieves pulling close the same labeled samples and rejecting unknown samples in the target domain