DeepGraphLearning/KnowledgeGraphEmbedding

The dimension of entity vector and relation vector

Joker-Song opened this issue · 1 comments

re_head, im_head = torch.chunk(head, 2, dim=2)
re_tail, im_tail = torch.chunk(tail, 2, dim=2)
#Make phases of relations uniformly distributed in [-pi, pi]
phase_relation = relation/(self.embedding_range.item()/pi)
re_relation = torch.cos(phase_relation)
im_relation = torch.sin(phase_relation)

Here the re_head, im_head are hidden_size vectors but the L208-L211 wouldn't change the dimension of relation vector, so the re_relation and im_relation are both hidden_size*2 vector. How can you operate them with different dimension.

self.entity_dim = hidden_dim*2 if double_entity_embedding else hidden_dim
self.relation_dim = hidden_dim*2 if double_relation_embedding else hidden_dim

We have double_entity_embedding and double_relation_embedding arguments for our models. In the RotatE model, double_entity_embedding = True and double_relation_embedding = False. So the chunked entity dimension would be equal to the relation dimension.