torchkge-team / torchkge

TorchKGE: Knowledge Graph embedding in Python and PyTorch.
Other
381 stars 41 forks source link

Bug of TransH #241

Closed xiatingyu closed 2 years ago

xiatingyu commented 2 years ago

Description

In file "translation" line 210-215 self.ent_emb.weight.data = normalize(self.ent_emb.weight.data, p=2, dim=1) self.norm_vect.weight.data = normalize(self.norm_vect.weight.data, p=2, dim=1) self.rel_emb.weight.data = self.project(self.ent_emb.weight.data, self.norm_vect.weight.data)

For self.rel_emb.weight.data, why is "self.project(self.ent_emb.weight.data,self.norm_vect.weight.data)"? And it shows this bug, during the model initialization phase: RuntimeError: The size of tensor a (14541) must match the size of tensor b (237) at non-singleton dimension 0

xiatingyu commented 2 years ago

Maybe it should change to self.rel_emb.weight.data = self.project(self.rel_emb.weight.data, self.norm_vect.weight.data)

armand33 commented 2 years ago

Hello, Thank you @xiatingyu for pointing that out. The issue has been fixed by PR #242 and the patch has been released in v0.17.5. Thanks