code: def test_batching_with_new_dimension():
      torch_geometric.set_debug(True)
  
      class MyData(Data):
          def __cat_dim__(self, key, value, *args, **kwargs):
              if key == "foo":
                  return None
              else:
                  return super().__cat_dim__(
                      key, value, *args, **kwargs
                  )
  
      x1 = torch.tensor([1, 2, 3], dtype=torch.float)
      foo1 = torch.randn(4)
      y1 = torch.tensor(1)
  
      x2 = torch.tensor([1, 2], dtype=torch.float)
      foo2 = torch.randn(4)
      y2 = torch.tensor(2)
  
      batch = Batch.from_data_list(
          [MyData(x=x1, foo=foo1, y=y1), MyData(x=x2, foo=foo2, y=y2)]
      )
  
      assert str(batch) == (
          "MyDataBatch(x=[5], y=[2], foo=[2, 4], batch=[5], " "ptr=[3])"
      )
      assert batch.num_graphs == len(batch) == 2
      assert batch.x.tolist() == [1, 2, 3, 1, 2]
      assert batch.foo.size() == (2, 4)
      assert batch.foo[0].tolist() == foo1.tolist()
      assert batch.foo[1].tolist() == foo2.tolist()
      assert batch.y.tolist() == [1, 2]
      assert batch.batch.tolist() == [0, 0, 0, 1, 1]
      assert batch.ptr.tolist() == [0, 3, 5]
      assert batch.num_graphs == 2
  
      data = batch[0]
      assert str(data) == ("MyData(x=[3], y=[1], foo=[4])")
      data = batch[1]
      assert str(data) == ("MyData(x=[2], y=[1], foo=[4])")
  
      torch_geometric.set_debug(True)
  
imports: import os.path
  import numpy
  import pytest
  import torch
  import torch_geometric
  from torch_geometric import EdgeIndex
  from torch_geometric.data import Batch, Data, HeteroData
  from torch_geometric.testing import get_random_edge_index, withPackage
  from torch_geometric.typing import SparseTensor
  from torch_geometric.utils import to_edge_index, to_torch_sparse_tensor
label_desc: Use image node_id 5 for calling a global function with example usage: test_batching_with_new_dimension() and returns: None, super