class_docstr: KGNN-LS is a knowledge-based recommendation model.
  KGNN-LS transforms the knowledge graph into a user-specific weighted graph and then apply a graph neural network to
  compute personalized item embeddings. To provide better inductive bias, KGNN-LS relies on label smoothness
  assumption, which posits that adjacent items in the knowledge graph are likely to have similar user relevance
  labels/scores. Label smoothness provides regularization over the edge weights and it is equivalent  to a label
  propagation scheme on a graph.
docstr: Get neighbors and corresponding relations for each entity in items from adj_entity and adj_relation.
  
  Args:
      items(torch.LongTensor): The input tensor that contains item's id, shape: [batch_size, ]
  
  Returns:
      tuple:
          - 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, 1],
            [batch_size, n_neighbor],
            [batch_size, n_neighbor^2],
            ...,
            [batch_size, 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.
docstr_tok: ["Get","neighbors","and","corresponding","relations","for","each","entity","in","items","from","adj_entity","and","adj_relation",".","Args",":","items","(","torch.LongTensor",")",":","The","input","tensor","that","contains","item","'s","id",",","shape",":","[","batch_size",",","]","Returns",":","tuple",":","-","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",",","1","]",",","[","batch_size",",","n_neighbor","]",",","[","batch_size",",","n_neighbor^2","]",",","...",",","[","batch_size",",","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","."]
code: def get_neighbors(self, items):
      r"""Get neighbors and corresponding relations for each entity in items from adj_entity and adj_relation.
  
      Args:
          items(torch.LongTensor): The input tensor that contains item's id, shape: [batch_size, ]
  
      Returns:
          tuple:
              - 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, 1],
                [batch_size, n_neighbor],
                [batch_size, n_neighbor^2],
                ...,
                [batch_size, 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.
      """
      items = torch.unsqueeze(items, dim=1)
      entities = [items]
      relations = []
      for i in range(self.n_iter):
          index = torch.flatten(entities[i])
          neighbor_entities = torch.index_select(
              self.adj_entity, 0, index
          ).reshape(self.batch_size, -1)
          neighbor_relations = torch.index_select(
              self.adj_relation, 0, index
          ).reshape(self.batch_size, -1)
          entities.append(neighbor_entities)
          relations.append(neighbor_relations)
      return entities, relations
  
imports: import random
  import numpy
  import torch
  import torch.nn
  from recbole.model.abstract_recommender import KnowledgeRecommender
  from recbole.model.init import xavier_normal_initialization
  from recbole.model.loss import EmbLoss
  from recbole.utils import InputType
label_desc: Use image node_id 5 for calling the KGNNLS obj's underlying member method code with example usage: obj.get_neighbors(items) and returns: entities,  relations