code: def forward(
      self,
      layer: int,
      num_sampled_nodes_per_hop: Optional[List[int]],
      num_sampled_edges_per_hop: Optional[List[int]],
      x: Tensor,
      edge_index: Adj,
      edge_attr: Optional[Tensor] = None,
  ) -> Tuple[Tensor, Adj, Optional[Tensor]]:
      if not isinstance(num_sampled_nodes_per_hop, list) and isinstance(
          num_sampled_edges_per_hop, list
      ):
          raise ValueError(
              "'num_sampled_nodes_per_hop' needs to be given"
          )
      if not isinstance(num_sampled_edges_per_hop, list) and isinstance(
          num_sampled_nodes_per_hop, list
      ):
          raise ValueError(
              "'num_sampled_edges_per_hop' needs to be given"
          )
  
      if num_sampled_nodes_per_hop is None:
          return x, edge_index, edge_attr
      if num_sampled_edges_per_hop is None:
          return x, edge_index, edge_attr
  
      return trim_to_layer(
          layer,
          num_sampled_nodes_per_hop,
          num_sampled_edges_per_hop,
          x,
          edge_index,
          edge_attr,
      )
  
file_path: pytorch_geometric/torch_geometric/utils/_trim_to_layer.py
imports: import copy
  from typing import Any, Dict, List, Optional, Tuple, Union, overload
  import torch
  from torch import Tensor
  from torch_geometric.typing import Adj, EdgeType, MaybeHeteroAdjTensor, MaybeHeteroEdgeTensor, MaybeHeteroNodeTensor, NodeType, SparseStorage, SparseTensor
label_desc: Use image node_id 1 for calling the TrimToLayer obj's underlying member method code with example usage: obj.forward(layer, num_sampled_nodes_per_hop, num_sampled_edges_per_hop, x, edge_index, edge_attr) and returns: trim_to_layer, x,  edge_index,  edge_attr, x,  edge_index,  edge_attr