def label_smoothness_predict(self, user_embeddings, user, entities, relations):
    'Predict the label of items by label smoothness.\n\n        Args:\n            user_embeddings(torch.FloatTensor): The embeddings of users, shape: [batch_size*2, embedding_size],\n            user(torch.FloatTensor): the index of users, shape: [batch_size*2]\n            entities(list): entities is a list of i-iter (i = 0, 1, ..., n_iter) neighbors for the batch of items.\n                            dimensions of entities: {[batch_size*2, 1],\n                            [batch_size*2, n_neighbor],\n                            [batch_size*2, n_neighbor^2],\n                            ...,\n                            [batch_size*2, n_neighbor^n_iter]}\n            relations(list): relations is a list of i-iter (i = 0, 1, ..., n_iter) corresponding relations for entities.\n                             relations have the same shape as entities.\n\n        Returns:\n            predicted_labels(torch.FloatTensor): The predicted label of items, shape: [batch_size*2]\n        '
    entity_labels = []
    reset_masks = []
    holdout_item_for_user = None
    for entities_per_iter in entities:
        users = torch.unsqueeze(user, dim=1)
        user_entity_concat = ((users * self.offset) + entities_per_iter)
        if (holdout_item_for_user is None):
            holdout_item_for_user = user_entity_concat

        def lookup_interaction_table(x, _):
            x = int(x)
            label = self.interaction_table.setdefault(x, 0.5)
            return label
        initial_label = user_entity_concat.clone().cpu().double()
        initial_label.map_(initial_label, lookup_interaction_table)
        initial_label = initial_label.float().to(self.device)
        holdout_mask = (holdout_item_for_user - user_entity_concat).bool()
        reset_mask = (initial_label - 0.5).bool()
        reset_mask = torch.logical_and(reset_mask, holdout_mask)
        initial_label = ((holdout_mask.float() * initial_label) + (torch.logical_not(holdout_mask).float() * 0.5))
        reset_masks.append(reset_mask)
        entity_labels.append(initial_label)
    reset_masks = reset_masks[:(- 1)]
    relation_vectors = [self.relation_embedding(i) for i in relations]
    for i in range(self.n_iter):
        entity_labels_next_iter = []
        for hop in range((self.n_iter - i)):
            masks = reset_masks[hop]
            self_labels = entity_labels[hop]
            neighbor_labels = torch.reshape(entity_labels[(hop + 1)], [self.batch_size, (- 1), self.neighbor_sample_size])
            neighbor_relations = torch.reshape(relation_vectors[hop], [self.batch_size, (- 1), self.neighbor_sample_size, self.embedding_size])
            user_embeddings = torch.reshape(user_embeddings, [self.batch_size, 1, 1, self.embedding_size])
            user_relation_scores = torch.mean((user_embeddings * neighbor_relations), dim=(- 1))
            user_relation_scores_normalized = self.softmax(user_relation_scores)
            neighbors_aggregated_label = torch.mean((user_relation_scores_normalized * neighbor_labels), dim=2)
            output = ((masks.float() * self_labels) + (torch.logical_not(masks).float() * neighbors_aggregated_label))
            entity_labels_next_iter.append(output)
        entity_labels = entity_labels_next_iter
    predicted_labels = entity_labels[0].squeeze((- 1))
    return predicted_labels
Predict the label of items by label smoothness.

Args:
    user_embeddings(torch.FloatTensor): The embeddings of users, shape: [batch_size*2, embedding_size],
    user(torch.FloatTensor): the index of users, shape: [batch_size*2]
    entities(list): entities is a list of i-iter (i = 0, 1, ..., n_iter) neighbors for the batch of items.
                    dimensions of entities: {[batch_size*2, 1],
                    [batch_size*2, n_neighbor],
                    [batch_size*2, n_neighbor^2],
                    ...,
                    [batch_size*2, n_neighbor^n_iter]}
    relations(list): relations is a list of i-iter (i = 0, 1, ..., n_iter) corresponding relations for entities.
                     relations have the same shape as entities.

Returns:
    predicted_labels(torch.FloatTensor): The predicted label of items, shape: [batch_size*2]
def label_smoothness_predict(self, user_embeddings, user, entities, relations):
    'Predict the label of items by label smoothness.\n\n        Args:\n            user_embeddings(torch.FloatTensor): The embeddings of users, shape: [batch_size*2, embedding_size],\n            user(torch.FloatTensor): the index of users, shape: [batch_size*2]\n            entities(list): entities is a list of i-iter (i = 0, 1, ..., n_iter) neighbors for the batch of items.\n                            dimensions of entities: {[batch_size*2, 1],\n                            [batch_size*2, n_neighbor],\n                            [batch_size*2, n_neighbor^2],\n                            ...,\n                            [batch_size*2, n_neighbor^n_iter]}\n            relations(list): relations is a list of i-iter (i = 0, 1, ..., n_iter) corresponding relations for entities.\n                             relations have the same shape as entities.\n\n        Returns:\n            predicted_labels(torch.FloatTensor): The predicted label of items, shape: [batch_size*2]\n        '
    entity_labels = []
    reset_masks = []
    holdout_item_for_user = None
    for entities_per_iter in entities:
        users = torch.unsqueeze(user, dim=1)
        user_entity_concat = ((users * self.offset) + entities_per_iter)
        if (holdout_item_for_user is None):
            holdout_item_for_user = user_entity_concat

        def lookup_interaction_table(x, _):
            x = int(x)
            label = self.interaction_table.setdefault(x, 0.5)
            return label
        initial_label = user_entity_concat.clone().cpu().double()
        initial_label.map_(initial_label, lookup_interaction_table)
        initial_label = initial_label.float().to(self.device)
        holdout_mask = (holdout_item_for_user - user_entity_concat).bool()
        reset_mask = (initial_label - 0.5).bool()
        reset_mask = torch.logical_and(reset_mask, holdout_mask)
        initial_label = ((holdout_mask.float() * initial_label) + (torch.logical_not(holdout_mask).float() * 0.5))
        reset_masks.append(reset_mask)
        entity_labels.append(initial_label)
    reset_masks = reset_masks[:(- 1)]
    relation_vectors = [self.relation_embedding(i) for i in relations]
    for i in range(self.n_iter):
        entity_labels_next_iter = []
        for hop in range((self.n_iter - i)):
            masks = reset_masks[hop]
            self_labels = entity_labels[hop]
            neighbor_labels = torch.reshape(entity_labels[(hop + 1)], [self.batch_size, (- 1), self.neighbor_sample_size])
            neighbor_relations = torch.reshape(relation_vectors[hop], [self.batch_size, (- 1), self.neighbor_sample_size, self.embedding_size])
            user_embeddings = torch.reshape(user_embeddings, [self.batch_size, 1, 1, self.embedding_size])
            user_relation_scores = torch.mean((user_embeddings * neighbor_relations), dim=(- 1))
            user_relation_scores_normalized = self.softmax(user_relation_scores)
            neighbors_aggregated_label = torch.mean((user_relation_scores_normalized * neighbor_labels), dim=2)
            output = ((masks.float() * self_labels) + (torch.logical_not(masks).float() * neighbors_aggregated_label))
            entity_labels_next_iter.append(output)
        entity_labels = entity_labels_next_iter
    predicted_labels = entity_labels[0].squeeze((- 1))
    return predicted_labels