class_docstr: Holds all the obtained explanations of a heterogeneous graph.
  
  The explanation object is a :obj:`~torch_geometric.data.HeteroData` object
  and can hold node attributions and edge attributions.
  It can also hold the original graph if needed.
code: def _apply_masks(
      self,
      node_mask_dict: Dict[NodeType, Tensor],
      edge_mask_dict: Dict[EdgeType, Tensor],
  ) -> "HeteroExplanation":
      out = copy.copy(self)
  
      for edge_type, edge_mask in edge_mask_dict.items():
          for key, value in self[edge_type].items():
              if key == "edge_index":
                  out[edge_type].edge_index = value[:, edge_mask]
              elif self[edge_type].is_edge_attr(key):
                  out[edge_type][key] = value[edge_mask]
  
      return out.subgraph(node_mask_dict)
  
imports: import copy
  from typing import Dict, List, Optional, Union
  import torch
  from torch import Tensor
  from torch_geometric.data.data import Data, warn_or_raise
  from torch_geometric.data.hetero_data import HeteroData
  from torch_geometric.explain.config import ThresholdConfig, ThresholdType
  from torch_geometric.typing import EdgeType, NodeType
  from torch_geometric.visualization import visualize_graph
label_desc: Use image node_id 4 for calling the HeteroExplanation obj's underlying member method code with example usage: obj._apply_masks(node_mask_dict, edge_mask_dict) and returns: out