code: def test_forward(data, target, explanation_type):
      model = DummyModel()
      assert model.training
  
      explainer = Explainer(
          model,
          algorithm=DummyExplainer(),
          explanation_type=explanation_type,
          node_mask_type="attributes",
          model_config=dict(
              mode="regression",
              task_level="graph",
          ),
      )
  
      if (
          target is None
          and explanation_type == ExplanationType.phenomenon
      ):
          with pytest.raises(ValueError):
              explainer(data.x, data.edge_index, target=target)
      else:
          explanation = explainer(
              data.x,
              data.edge_index,
              target=target
              if explanation_type == ExplanationType.phenomenon
              else None,
          )
          assert model.training
          assert isinstance(explanation, Explanation)
          assert "x" in explanation
          assert "edge_index" in explanation
          assert "target" in explanation
          assert "node_mask" in explanation.available_explanations
          assert explanation.node_mask.size() == data.x.size()
  
file_path: pytorch_geometric/test/explain/test_explainer.py
imports: import pytest
  import torch
  from torch_geometric.explain import DummyExplainer, Explainer, Explanation
  from torch_geometric.explain.config import ExplanationType
label_desc: Use image node_id 2 for calling a global function with example usage: test_forward(data, target, explanation_type) without return types