code: def create_dataloaders(
      trigraph, args, filter_dict=None, shared_ent_path=None
  ):
      """Construct DataLoader for training, validation and test."""
      train_dataset = KGDataset(
          triplets=trigraph.train_triplets,
          num_ents=trigraph.num_ents,
          args=args,
          filter_dict=filter_dict if args.filter_sample else None,
          shared_path={"ent": shared_ent_path}
          if args.mix_cpu_gpu
          else None,
      )
  
      train_sampler = DistributedBatchSampler(
          train_dataset,
          batch_size=args.batch_size,
          shuffle=True,
          drop_last=True,
      )
  
      train_loader = DataLoader(
          dataset=train_dataset,
          batch_sampler=train_sampler,
          num_workers=args.num_workers,
          collate_fn=train_dataset.collate_fn,
      )
  
      if args.valid:
          if args.data_name == "wikikg90m":
              valid_dataset = TestWikiKG90M(trigraph.valid_dict)
          elif args.data_name == "wikikg2":
              valid_dataset = TestWikiKG2(trigraph.valid_dict)
          else:
              valid_dataset = TestKGDataset(
                  trigraph.valid_dict, trigraph.num_ents
              )
          valid_loader = DataLoader(
              dataset=valid_dataset, batch_size=args.test_batch_size
          )
      else:
          valid_loader = None
  
      if args.test:
          if args.data_name == "wikikg90m":
              test_dataset = TestWikiKG90M(trigraph.test_dict)
          elif args.data_name == "wikikg2":
              test_dataset = TestWikiKG2(trigraph.test_dict)
          else:
              test_dataset = TestKGDataset(
                  trigraph.test_dict, trigraph.num_ents
              )
          test_loader = DataLoader(
              dataset=test_dataset, batch_size=args.test_batch_size
          )
      else:
          test_loader = None
  
      return train_loader, valid_loader, test_loader
  
imports: import os
  import numpy
  from numpy.random import default_rng
  import paddle
  from paddle.io import Dataset
  from paddle.io import DataLoader, DistributedBatchSampler
  from utils import timer_wrapper
label_desc: Use image node_id 1 for calling a global function with example usage: create_dataloaders(trigraph, args, filter_dict, shared_ent_path) and returns: train_loader,  valid_loader,  test_loader