code: def test_hgt_conv_different_dimensions():
      x_dict = {
          "author": torch.randn(4, 16),
          "paper": torch.randn(6, 32),
      }
      edge_index = coalesce(get_random_edge_index(4, 6, num_edges=20))
  
      edge_index_dict = {
          ("author", "writes", "paper"): edge_index,
          ("paper", "written_by", "author"): edge_index.flip([0]),
      }
  
      adj_t_dict1 = {}
      for edge_type, edge_index in edge_index_dict.items():
          src_type, _, dst_type = edge_type
          adj_t_dict1[edge_type] = to_torch_csc_tensor(
              edge_index,
              size=(x_dict[src_type].size(0), x_dict[dst_type].size(0)),
          ).t()
  
      metadata = (list(x_dict.keys()), list(edge_index_dict.keys()))
  
      conv = HGTConv(
          in_channels={"author": 16, "paper": 32},
          out_channels=32,
          metadata=metadata,
          heads=2,
      )
      assert str(conv) == "HGTConv(-1, 32, heads=2)"
      out_dict1 = conv(x_dict, edge_index_dict)
      assert len(out_dict1) == 2
      assert out_dict1["author"].size() == (4, 32)
      assert out_dict1["paper"].size() == (6, 32)
  
      out_dict2 = conv(x_dict, adj_t_dict1)
      assert len(out_dict1) == len(out_dict2)
      for key in out_dict1.keys():
          assert torch.allclose(
              out_dict1[key], out_dict2[key], atol=1e-6
          )
  
      if torch_geometric.typing.WITH_TORCH_SPARSE:
          adj_t_dict2 = {}
          for edge_type, edge_index in edge_index_dict.items():
              adj_t_dict2[edge_type] = SparseTensor.from_edge_index(
                  edge_index,
                  sparse_sizes=adj_t_dict1[edge_type].size()[::-1],
              ).t()
          out_dict3 = conv(x_dict, adj_t_dict2)
          assert len(out_dict1) == len(out_dict3)
          for node_type in out_dict1.keys():
              assert torch.allclose(
                  out_dict1[key], out_dict3[key], atol=1e-6
              )
  
file_path: pytorch_geometric/test/nn/conv/test_hgt_conv.py
imports: import torch
  import torch_geometric.typing
  from torch_geometric.data import HeteroData
  from torch_geometric.nn import HGTConv
  from torch_geometric.profile import benchmark
  from torch_geometric.testing import get_random_edge_index, withPackage
  from torch_geometric.typing import SparseTensor
  from torch_geometric.utils import coalesce, to_torch_csc_tensor
label_desc: Use image node_id 2 for calling a global function with example usage: test_hgt_conv_different_dimensions() without return types