code: def test_hetero_to_undirected():
      edge_index = torch.tensor([[2, 0], [3, 1]])
      edge_weight = torch.randn(edge_index.size(1))
      edge_attr = torch.randn(edge_index.size(1), 8)
  
      perm = torch.tensor([1, 1, 0, 0])
  
      data = HeteroData()
      data["v"].num_nodes = 4
      data["w"].num_nodes = 4
      data["v", "v"].edge_index = edge_index
      data["v", "v"].edge_weight = edge_weight
      data["v", "v"].edge_attr = edge_attr
      data["v", "w"].edge_index = edge_index
      data["v", "w"].edge_weight = edge_weight
      data["v", "w"].edge_attr = edge_attr
  
      from torch_geometric.transforms import ToUndirected
  
      assert not data.is_undirected()
      data = ToUndirected()(data)
      assert data.is_undirected()
  
      assert data["v", "v"].edge_index.tolist() == [
          [0, 1, 2, 3],
          [1, 0, 3, 2],
      ]
      assert (
          data["v", "v"].edge_weight.tolist()
          == edge_weight[perm].tolist()
      )
      assert (
          data["v", "v"].edge_attr.tolist() == edge_attr[perm].tolist()
      )
      assert data["v", "w"].edge_index.tolist() == edge_index.tolist()
      assert data["v", "w"].edge_weight.tolist() == edge_weight.tolist()
      assert data["v", "w"].edge_attr.tolist() == edge_attr.tolist()
      assert data["w", "v"].edge_index.tolist() == [[3, 1], [2, 0]]
      assert data["w", "v"].edge_weight.tolist() == edge_weight.tolist()
      assert data["w", "v"].edge_attr.tolist() == edge_attr.tolist()
  
imports: import torch
  from torch_geometric.data import Data, HeteroData
  from torch_geometric.transforms import ToUndirected
label_desc: Use image node_id 3 for calling a global function with example usage: test_hetero_to_undirected() without return types