code: def random_splits(
      dataset,
      seed,
      train_rate=0.6,
      val_rate=0.2,
  ):
      # print(dataset.y.shape[0])
      percls_trn = int(
          round(train_rate * dataset.y.shape[0] / dataset.num_classes)
      )
      val_lb = int(round(val_rate * dataset.y.shape[0]))
  
      index = [i for i in range(0, dataset.y.shape[0])]
      num_classes = dataset.num_classes
      train_idx = []
      rnd_state = np.random.RandomState(seed)
      for c in range(num_classes):
          class_idx = np.where(dataset.y == c)[0]
          if len(class_idx) < percls_trn:
              train_idx.extend(class_idx)
          else:
              train_idx.extend(
                  rnd_state.choice(class_idx, percls_trn, replace=False)
              )
      rest_index = [i for i in index if i not in train_idx]
      val_idx = rnd_state.choice(rest_index, val_lb, replace=False)
      test_idx = [i for i in rest_index if i not in val_idx]
  
      dataset.train_index = train_idx
      dataset.val_index = val_idx
      dataset.test_index = test_idx
      return dataset
  
imports: import numpy
  import pgl
  import paddle
label_desc: Use image node_id 3 for calling a global function with example usage: random_splits(dataset, seed, train_rate, val_rate) and returns: dataset