Пример #1
0
 def get_candidates(self, input_tensor):
     c = tf.math.softplus(self.c)
     items = tf.expand_dims(self.item.embeddings, 0)  # (1, n_item, rank)
     pp = tf.expand_dims(self.userpp(input_tensor[:, 0]),
                         1)  # (batch, 1, rank)
     cands_ts = tf.math.multiply(pp, items)  # (batch, n_item, rank)
     return hyp_utils.expmap0(cands_ts, c, self.rhs_dep_lhs)
Пример #2
0
 def get_rhs(self, input_tensor):
   rhs_ts = tf.math.multiply(
       self.userpp(input_tensor[:, 0]), self.item(input_tensor[:, 1]))
   c = tf.math.softplus(self.c)
   return hyp_utils.expmap0(rhs_ts, c)
Пример #3
0
 def get_queries(self, input_tensor):
   c = tf.math.softplus(self.c)
   lhs = hyp_utils.expmap0(self.user(input_tensor[:, 0]), c)
   return lhs
Пример #4
0
 def get_candidates(self, input_tensor):
   c = tf.math.softplus(self.c)
   temp = self.item.embeddings
   return hyp_utils.expmap0(temp, c)
Пример #5
0
 def get_rhs(self, input_tensor):
   c = tf.math.softplus(self.c)
   return hyp_utils.expmap0(self.item(input_tensor[:, 1]), c)