code: def split(
      data: Data, batch: Tensor
  ) -> Tuple[Data, Dict[str, Tensor]]:
      node_slice = cumsum(torch.from_numpy(np.bincount(batch)))
  
      assert data.edge_index is not None
      row, _ = data.edge_index
      edge_slice = cumsum(torch.from_numpy(np.bincount(batch[row])))
  
      # Edge indices should start at zero for every graph.
      data.edge_index -= node_slice[batch[row]].unsqueeze(0)
  
      slices = {"edge_index": edge_slice}
      if data.x is not None:
          slices["x"] = node_slice
      else:
          # Imitate `collate` functionality:
          data._num_nodes = torch.bincount(batch).tolist()
          data.num_nodes = batch.numel()
      if data.edge_attr is not None:
          slices["edge_attr"] = edge_slice
      if data.y is not None:
          assert isinstance(data.y, Tensor)
          if data.y.size(0) == batch.size(0):
              slices["y"] = node_slice
          else:
              slices["y"] = torch.arange(
                  0, int(batch[-1]) + 2, dtype=torch.long
              )
  
      return data, slices
  
file_path: pytorch_geometric/torch_geometric/io/tu.py
imports: import os.path
  from typing import Dict, List, Optional, Tuple
  import numpy
  import torch
  from torch import Tensor
  from torch_geometric.data import Data
  from torch_geometric.io import fs, read_txt_array
  from torch_geometric.utils import coalesce, cumsum, one_hot, remove_self_loops
label_desc: Use image node_id 4 for calling a global function with example usage: split(data, batch) and returns: data,  slices