class_docstr: :class:`KGSampler` is used to sample negative entities in a knowledge graph.
  
  Args:
      dataset (Dataset): The knowledge graph dataset, which contains triplets in a knowledge graph.
      distribution (str, optional): Distribution of the negative entities. Defaults to 'uniform'.
class_docstr_tok: [":","class",":","`","KGSampler","`","is","used","to","sample","negative","entities","in","a","knowledge","graph",".","Args",":","dataset","(","Dataset",")",":","The","knowledge","graph","dataset",",","which","contains","triplets","in","a","knowledge","graph",".","distribution","(","str",",","optional",")",":","Distribution","of","the","negative","entities",".","Defaults","to","'uniform","'","."]
docstr: Returns:
      numpy.ndarray: Used entity_ids is the same as tail_entity_ids in knowledge graph.
      Index is head_entity_id, and element is a set of tail_entity_ids.
docstr_tok: ["Returns",":","numpy.ndarray",":","Used","entity_ids","is","the","same","as","tail_entity_ids","in","knowledge","graph",".","Index","is","head_entity_id",",","and","element","is","a","set","of","tail_entity_ids","."]
code: def get_used_ids(self):
      """
      Returns:
          numpy.ndarray: Used entity_ids is the same as tail_entity_ids in knowledge graph.
          Index is head_entity_id, and element is a set of tail_entity_ids.
      """
      used_tail_entity_id = np.array(
          [set() for _ in range(self.entity_num)]
      )
      for hid, tid in zip(self.hid_list, self.tid_list):
          used_tail_entity_id[hid].add(tid)
  
      for used_tail_set in used_tail_entity_id:
          if (
              len(used_tail_set) + 1 == self.entity_num
          ):  # [pad] is a entity.
              raise ValueError(
                  "Some head entities have relation with all entities, "
                  "which we can not sample negative entities for them."
              )
      return used_tail_entity_id
  
imports: import copy
  import numpy
  from numpy.random import sample
  import torch
  from collections import Counter
label_desc: Use image node_id 4 for calling the KGSampler obj's underlying member method code with example usage: obj.get_used_ids() and returns: used_tail_entity_id