code: def test_torch_dataloader_collate(self):
      # graph classification example
      pyg_dataset = TUDataset("./enzymes", "ENZYMES")
      graphs = GraphDataset.pyg_to_graphs(pyg_dataset)
      dataset = GraphDataset(graphs, task="graph")
      train_batch_num = math.ceil(len(dataset) * 0.8 / 32)
      test_batch_num = math.ceil(len(dataset) * 0.1 / 32)
      val_batch_num = math.ceil(len(dataset) * 0.1 / 32)
      datasets = {}
      (
          datasets["train"],
          datasets["val"],
          datasets["test"],
      ) = dataset.split(transductive=False, split_ratio=[0.8, 0.1, 0.1])
      dataloaders = {
          split: DataLoader(
              dataset,
              collate_fn=Batch.collate(),
              batch_size=32,
              shuffle=True,
          )
          for split, dataset in datasets.items()
      }
  
      self.assertEqual(len(dataloaders["train"]), train_batch_num)
      self.assertEqual(len(dataloaders["val"]), test_batch_num)
      self.assertEqual(len(dataloaders["test"]), val_batch_num)
      for i, data in enumerate(dataloaders["train"]):
          if i != len(dataloaders["train"]) - 1:
              self.assertEqual(data.num_graphs, 32)
      for i, data in enumerate(dataloaders["val"]):
          if i != len(dataloaders["val"]) - 1:
              self.assertEqual(data.num_graphs, 32)
      for i, data in enumerate(dataloaders["test"]):
          if i != len(dataloaders["test"]) - 1:
              self.assertEqual(data.num_graphs, 32)
  
file_path: deepsnap/tests/test_batch.py
imports: import math
  import unittest
  from copy import deepcopy
  import torch
  import networkx
  from torch.utils.data import DataLoader
  from torch_geometric.datasets import TUDataset
  from deepsnap.graph import Graph
  from deepsnap.batch import Batch
  from deepsnap.dataset import GraphDataset
  from tests.utils import simple_networkx_graph
label_desc: Use image node_id 2 for calling the TestBatch obj's underlying member method code with example usage: obj.test_torch_dataloader_collate() without return types