code: def from_data_list_token(data_list, follow_batch=[]):
      """This is pretty a copy paste of the from data list of pytorch geometric
      batch object with the difference that indexes that are negative are not incremented
      """
  
      keys = [set(data.keys) for data in data_list]
      keys = list(set.union(*keys))
      assert "batch" not in keys
  
      batch = Batch()
      batch.__data_class__ = data_list[0].__class__
      batch.__slices__ = {key: [0] for key in keys}
  
      for key in keys:
          batch[key] = []
  
      for key in follow_batch:
          batch["{}_batch".format(key)] = []
  
      cumsum = {key: 0 for key in keys}
      batch.batch = []
      for i, data in enumerate(data_list):
          for key in data.keys:
              item = data[key]
              if (
                  torch.is_tensor(item)
                  and item.dtype != torch.bool
                  and cumsum[key] > 0
              ):
                  mask = item >= 0
                  item[mask] = item[mask] + cumsum[key]
              if torch.is_tensor(item):
                  size = item.size(data.__cat_dim__(key, data[key]))
              else:
                  size = 1
              batch.__slices__[key].append(
                  size + batch.__slices__[key][-1]
              )
              cumsum[key] += data.__inc__(key, item)
              batch[key].append(item)
  
              if key in follow_batch:
                  item = torch.full((size,), i, dtype=torch.long)
                  batch["{}_batch".format(key)].append(item)
  
          num_nodes = data.num_nodes
          if num_nodes is not None:
              item = torch.full((num_nodes,), i, dtype=torch.long)
              batch.batch.append(item)
  
      if num_nodes is None:
          batch.batch = None
  
      for key in batch.keys:
          item = batch[key][0]
          if torch.is_tensor(item):
              batch[key] = torch.cat(
                  batch[key], dim=data_list[0].__cat_dim__(key, item)
              )
          elif isinstance(item, int) or isinstance(item, float):
              batch[key] = torch.tensor(batch[key])
          else:
              raise ValueError(
                  "Unsupported attribute type {} : {}".format(
                      type(item), item
                  )
              )
  
      if torch_geometric.is_debug_enabled():
          batch.debug()
  
      return batch.contiguous()
  
file_path: torch-points3d/torch_points3d/datasets/multiscale_data.py
imports: from typing import List, Optional
  import torch
  import copy
  import torch_geometric
  from torch_geometric.data import Data
  from torch_geometric.data import Batch
label_desc: Use image node_id 1 for calling a global function with example usage: from_data_list_token(data_list, follow_batch) and returns: batch