code: def test_to_hetero_with_bases_and_rgcn_equal_output():
      torch.manual_seed(1234)
  
      # Run `RGCN` with basis decomposition:
      x = torch.randn(10, 16)  # 6 paper nodes, 4 author nodes
      adj = torch.rand(10, 10) > 0.5
      adj[6:, 6:] = False
      edge_index = adj.nonzero(as_tuple=False).t().contiguous()
      row, col = edge_index
  
      # # 0 = paper<->paper, 1 = author->paper, 2 = paper->author
      edge_type = torch.full(
          (edge_index.size(1),), -1, dtype=torch.long
      )
      edge_type[(row < 6) & (col < 6)] = 0
      edge_type[(row < 6) & (col >= 6)] = 1
      edge_type[(row >= 6) & (col < 6)] = 2
      assert edge_type.min() == 0
  
      num_bases = 4
      conv = RGCNConv(
          16, 32, num_relations=3, num_bases=num_bases, aggr="add"
      )
      out1 = conv(x, edge_index, edge_type)
  
      # Run `to_hetero_with_bases`:
      x_dict = {
          "paper": x[:6],
          "author": x[6:],
      }
      edge_index_dict = {
          ("paper", "_", "paper"): edge_index[:, edge_type == 0],
          ("paper", "_", "author"): edge_index[:, edge_type == 1]
          - torch.tensor([[0], [6]]),
          ("author", "_", "paper"): edge_index[:, edge_type == 2]
          - torch.tensor([[6], [0]]),
      }
  
      if torch_geometric.typing.WITH_TORCH_SPARSE:
          adj_t_dict = {
              key: SparseTensor.from_edge_index(edge_index).t()
              for key, edge_index in edge_index_dict.items()
          }
  
      metadata = (list(x_dict.keys()), list(edge_index_dict.keys()))
      model = to_hetero_with_bases(
          RGCN(16, 32), metadata, num_bases=num_bases, debug=False
      )
  
      # Set model weights:
      for i in range(num_bases):
          model.conv.convs[i].lin.weight.data = conv.weight[i].data.t()
          model.conv.convs[i].edge_type_weight.data = conv.comp[
              :, i
          ].data.t()
  
      model.lin.weight.data = conv.root.data.t()
      model.lin.bias.data = conv.bias.data
  
      out2 = model(x_dict, edge_index_dict)
      out2 = torch.cat([out2["paper"], out2["author"]], dim=0)
      assert torch.allclose(out1, out2, atol=1e-6)
  
      if torch_geometric.typing.WITH_TORCH_SPARSE:
          out3 = model(x_dict, adj_t_dict)
          out3 = torch.cat([out3["paper"], out3["author"]], dim=0)
          assert torch.allclose(out1, out3, atol=1e-6)
  
imports: from typing import Tuple
  import pytest
  import torch
  from torch import Tensor
  from torch.nn import Linear, ReLU, Sequential
  import torch_geometric.typing
  from torch_geometric.nn import GINEConv, MessagePassing, RGCNConv, SAGEConv, to_hetero_with_bases
  from torch_geometric.typing import SparseTensor
label_desc: Use image node_id 2 for calling a global function with example usage: test_to_hetero_with_bases_and_rgcn_equal_output() without return types