code: def collate_fn(data_batch_list):
      r"""
      The collate function used to form a mini-batch of data when creating data loaders with the dataset class dig.ggraph3D.dataset.QM93DGEN.
  
      Args:
          data_batch_list: a list of python dict returned from the get function of dig.ggraph3D.dataset.QM93DGEN.
      :rtype: :class:`dict` a python dict with the same keys as every python dict in data_batch_list.
      """
      data_batch = {}
  
      for key in [
          "atom_type",
          "position",
          "new_atom_type",
          "new_dist",
          "new_angle",
          "new_torsion",
          "cannot_focus",
      ]:
          data_batch[key] = torch.cat(
              [mol_dict[key] for mol_dict in data_batch_list], dim=0
          )
  
      num_steps_list = torch.tensor(
          [0]
          + [
              len(data_batch_list[i]["new_atom_type"])
              for i in range(len(data_batch_list) - 1)
          ]
      )
      batch_idx_offsets = torch.cumsum(num_steps_list, dim=0)
      repeats = torch.tensor(
          [len(mol_dict["batch"]) for mol_dict in data_batch_list]
      )
      batch_idx_repeated_offsets = torch.repeat_interleave(
          batch_idx_offsets, repeats
      )
      batch_offseted = (
          torch.cat(
              [mol_dict["batch"] for mol_dict in data_batch_list], dim=0
          )
          + batch_idx_repeated_offsets
      )
      data_batch["batch"] = batch_offseted
  
      num_atoms_list = torch.tensor(
          [0]
          + [
              len(data_batch_list[i]["atom_type"])
              for i in range(len(data_batch_list) - 1)
          ]
      )
      atom_idx_offsets = torch.cumsum(num_atoms_list, dim=0)
      for key in ["focus", "c1_focus", "c2_c1_focus"]:
          repeats = torch.tensor(
              [len(mol_dict[key]) for mol_dict in data_batch_list]
          )
          atom_idx_repeated_offsets = torch.repeat_interleave(
              atom_idx_offsets, repeats
          )
          atom_offseted = (
              torch.cat(
                  [mol_dict[key] for mol_dict in data_batch_list], dim=0
              )
              + atom_idx_repeated_offsets[:, None]
          )
          data_batch[key] = atom_offseted
  
      return data_batch
  
imports: import os
  import os.path
  import numpy
  import torch
  import networkx
  from networkx.algorithms import tree
  from math import pi
  from rdkit import Chem
  from rdkit.Chem.rdchem import BondType
  from torch_geometric.data import Data, InMemoryDataset, download_url, extract_tar
label_desc: Use image node_id 1 for calling a global function with example usage: collate_fn(data_batch_list) and returns: data_batch