code: def filter_edge_store_(
      store: EdgeStorage,
      out_store: EdgeStorage,
      row: Tensor,
      col: Tensor,
      index: OptTensor,
      perm: OptTensor = None,
  ):
      # Filters a edge storage object to only hold the edges in `index`,
      # which represents the new graph as denoted by `(row, col)`:
      for key, value in store.items():
          if key == "edge_index":
              # TODO Integrate `EdgeIndex` into `custom_store`.
              out_store.edge_index = EdgeIndex(
                  torch.stack([row, col], dim=0).to(value.device),
                  sparse_size=out_store.size(),
                  sort_order="col",
                  # TODO Support `is_undirected`.
              )
  
          elif key == "adj_t":
              # NOTE: We expect `(row, col)` to be sorted by `col` (CSC layout).
              row = row.to(value.device())
              col = col.to(value.device())
              edge_attr = value.storage.value()
              if edge_attr is not None:
                  if index is not None:
                      index = index.to(edge_attr.device)
                      edge_attr = index_select(edge_attr, index, dim=0)
                  else:
                      edge_attr = None
              sparse_sizes = out_store.size()[::-1]
              # TODO Currently, we set `is_sorted=False`, see:
              # https://github.com/pyg-team/pytorch_geometric/issues/4346
              out_store.adj_t = SparseTensor(
                  row=col,
                  col=row,
                  value=edge_attr,
                  sparse_sizes=sparse_sizes,
                  is_sorted=False,
                  trust_data=True,
              )
  
          elif store.is_edge_attr(key):
              if index is None:
                  out_store[key] = None
                  continue
  
              dim = store._parent().__cat_dim__(key, value, store)
              if isinstance(value, (Tensor, TensorFrame)):
                  index = index.to(value.device)
              elif isinstance(value, np.ndarray):
                  index = index.cpu()
              if perm is None:
                  out_store[key] = index_select(value, index, dim=dim)
              else:
                  if isinstance(value, (Tensor, TensorFrame)):
                      perm = perm.to(value.device)
                  elif isinstance(value, np.ndarray):
                      perm = perm.cpu()
                  out_store[key] = index_select(
                      value,
                      perm[index.to(torch.int64)],
                      dim=dim,
                  )
  
imports: import copy
  import logging
  import math
  from typing import Any, Dict, Optional, Tuple, Union
  import numpy
  import torch
  from torch import Tensor
  import torch_geometric.typing
  from torch_geometric import EdgeIndex
  from torch_geometric.data import Data, FeatureStore, GraphStore, HeteroData, TensorAttr, remote_backend_utils
  from torch_geometric.data.storage import EdgeStorage, NodeStorage
  from torch_geometric.typing import EdgeType, FeatureTensorType, InputEdges, InputNodes, NodeType, OptTensor, SparseTensor, TensorFrame
label_desc: Use image node_id 3 for calling a global function with example usage: filter_edge_store_(store, out_store, row, col, index, perm) without return types