class_docstr: Dataset for training
  
  Parameters
  ----------
  dataset : KGDataset
      Original dataset.
  args :
      Global configs.
  ranks:
      Number of partitions.
class_docstr_tok: ["Dataset","for","training","Parameters","--","--","--","--","--","dataset",":","KGDataset","Original","dataset",".","args",":","Global","configs",".","ranks",":","Number","of","partitions","."]
code: def __init__(self, dataset, args, ranks=64, has_importance=False):
      triples = dataset.train
      num_train = len(triples[0])
      print("|Train|:", num_train)
  
      if ranks > 1 and args.rel_part:
          (
              self.edge_parts,
              self.rel_parts,
              self.cross_part,
              self.cross_rels,
          ) = SoftRelationPartition(
              triples, ranks, has_importance=has_importance
          )
      elif ranks > 1:
          self.edge_parts = RandomPartition(
              triples, ranks, has_importance=has_importance
          )
          self.cross_part = True
      else:
          self.edge_parts = [np.arange(num_train)]
          self.rel_parts = [np.arange(dataset.n_relations)]
          self.cross_part = True
  
      self.g = ConstructGraph(triples, dataset.n_entities, args)
  
imports: import math
  import numpy
  import scipy
  import dgl.backend
  import dgl
  import os
  import sys
  import pickle
  import time
  from dgl.base import NID, EID
  import pdb
label_desc: Use image node_id 1 to create a new TrainDataset object from inherited base classes: object with example: obj = TrainDataset(dataset, args, ranks, has_importance)