code: def test_captum_hetero_data(
      method,
      node_mask_type,
      edge_mask_type,
      index,
      hetero_data,
      hetero_model,
  ):
      model_config = ModelConfig(mode="regression", task_level="node")
  
      explainer = Explainer(
          hetero_model(hetero_data.metadata()),
          algorithm=CaptumExplainer(method),
          edge_mask_type=edge_mask_type,
          node_mask_type=node_mask_type,
          model_config=model_config,
          explanation_type="model",
      )
  
      explanation = explainer(
          hetero_data.x_dict, hetero_data.edge_index_dict, index=index
      )
  
      explanation.validate(raise_on_error=True)
  
file_path: pytorch_geometric/test/explain/algorithm/test_captum_explainer.py
imports: from typing import Optional
  import pytest
  import torch
  from torch_geometric.explain import Explainer, Explanation
  from torch_geometric.explain.algorithm import CaptumExplainer
  from torch_geometric.explain.config import MaskType, ModelConfig, ModelMode, ModelReturnType, ModelTaskLevel
  from torch_geometric.nn import GCNConv, global_add_pool
  from torch_geometric.testing import withPackage
label_desc: Use image node_id 5 for calling a global function with example usage: test_captum_hetero_data(method, node_mask_type, edge_mask_type, index, hetero_data, hetero_model) without return types