def get_rhs(self, input_tensor):
     tails = super().get_rhs(input_tensor)
     return hmath.expmap0(tails, self.get_c())
 def get_all_items(self, input_tensor):
     all_items = super().get_all_items(input_tensor)
     return hmath.expmap0(all_items, self.get_c())
 def get_lhs(self, input_tensor):
     c = self.get_c()
     head_embeds = hmath.expmap0(self.get_heads(input_tensor), c)
     relation_embeds = hmath.expmap0(self.relations(input_tensor[:, 1]), c)
     return hmath.mobius_add(head_embeds, relation_embeds, c)
 def get_lhs(self, input_tensor):
     heads = super().get_lhs(input_tensor)
     return hmath.expmap0(heads, self.get_c())
 def get_rhs(self, input_tensor):
     tails = hmath.expmap0(self.entities(input_tensor[:, -1]), self.get_c())
     relation_additions = hmath.expmap0(self.relations(input_tensor[:, 1]), self.get_c())
     return hmath.mobius_add(tails, relation_additions, self.get_c())
 def get_lhs(self, input_tensor):
     tg_heads = self.entities(input_tensor[:, 0])
     tg_relation_transforms = self.transforms(input_tensor[:, 1])
     return hmath.expmap0(tg_relation_transforms * tg_heads, self.get_c())
 def get_lhs(self, input_tensor):
     c = self.get_c()
     head = hmath.expmap0(self.entities(input_tensor[:, 0]), c)
     relations = hmath.expmap0(self.relations(input_tensor[:, 1]), c)
     return hmath.mobius_add(head, relations, c)
 def get_rhs(self, input_tensor):
     return hmath.expmap0(self.entities(input_tensor[:, -1]), self.get_c())
Пример #9
0
def to_hyperbolic(embeds, c_value):
    return expmap0(tf.convert_to_tensor(embeds),
                   tf.convert_to_tensor([c_value], dtype=tf.float64)).numpy()