code: def test_hetero_data_empty_subgraph():
      data = HeteroData()
      data.num_node_types = 3
      data["paper"].x = torch.arange(5)
      data["author"].x = torch.arange(5)
      data["paper", "author"].edge_weight = torch.arange(5)
  
      out = data.subgraph(
          subset_dict={
              "paper": torch.tensor([1, 2, 3]),
              "author": torch.tensor([1, 2, 3]),
          }
      )
  
      assert torch.equal(out["paper"].x, torch.arange(1, 4))
      assert out["paper"].num_nodes == 3
      assert torch.equal(out["author"].x, torch.arange(1, 4))
      assert out["author"].num_nodes == 3
      assert "edge_index" not in out["paper", "author"]
      assert torch.equal(
          out["paper", "author"].edge_weight, torch.arange(5)
      )
  
imports: import copy
  import pytest
  import torch
  from torch_geometric.data import HeteroData
  from torch_geometric.data.storage import EdgeStorage
  from torch_geometric.testing import get_random_edge_index, get_random_tensor_frame, withPackage
  from torch_geometric.typing import TensorFrame
label_desc: Use image node_id 8 for calling a global function with example usage: test_hetero_data_empty_subgraph() without return types