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)
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)
def get_queries(self, input_tensor): c = tf.math.softplus(self.c) lhs = hyp_utils.expmap0(self.user(input_tensor[:, 0]), c) return lhs
def get_candidates(self, input_tensor): c = tf.math.softplus(self.c) temp = self.item.embeddings return hyp_utils.expmap0(temp, c)
def get_rhs(self, input_tensor): c = tf.math.softplus(self.c) return hyp_utils.expmap0(self.item(input_tensor[:, 1]), c)