class_docstr: :class:`KGDataLoader` is a dataloader which would return the triplets with negative examples
  in a knowledge graph.
  
  Args:
      config (Config): The config of dataloader.
      dataset (Dataset): The dataset of dataloader.
      sampler (KGSampler): The knowledge graph sampler of dataloader.
      shuffle (bool, optional): Whether the dataloader will be shuffle after a round. Defaults to ``False``.
  
  Attributes:
      shuffle (bool): Whether the dataloader will be shuffle after a round.
          However, in :class:`KGDataLoader`, it's guaranteed to be ``True``.
class_docstr_tok: [":","class",":","`","KGDataLoader","`","is","a","dataloader","which","would","return","the","triplets","with","negative","examples","in","a","knowledge","graph",".","Args",":","config","(","Config",")",":","The","config","of","dataloader",".","dataset","(","Dataset",")",":","The","dataset","of","dataloader",".","sampler","(","KGSampler",")",":","The","knowledge","graph","sampler","of","dataloader",".","shuffle","(","bool",",","optional",")",":","Whether","the","dataloader","will","be","shuffle","after","a","round",".","Defaults","to","``","False","``",".","Attributes",":","shuffle","(","bool",")",":","Whether","the","dataloader","will","be","shuffle","after","a","round",".","However",",","in",":","class",":","`","KGDataLoader","`",",","it","'s","guaranteed","to","be","``","True","``","."]
code: def collate_fn(self, index):
      index = np.array(index)
      cur_data = self._dataset.kg_feat[index]
      head_ids = cur_data[self.hid_field].numpy()
      neg_tail_ids = self._sampler.sample_by_entity_ids(
          head_ids, self.neg_sample_num
      )
      cur_data.update(Interaction({self.neg_tid_field: neg_tail_ids}))
      return cur_data
  
file_path: RecBole/recbole/data/dataloader/knowledge_dataloader.py
imports: from logging import getLogger
  from recbole.data.dataloader.abstract_dataloader import AbstractDataLoader
  from recbole.data.dataloader.general_dataloader import TrainDataLoader
  from recbole.data.interaction import Interaction
  from recbole.utils import InputType, KGDataLoaderState
  import numpy
label_desc: Use image node_id 3 for calling the KGDataLoader obj's underlying member method code with example usage: obj.collate_fn(index) and returns: cur_data