code: def test_edge_mask(data):
      edge_mask = torch.tensor([1.0, 0.0, 1.0, 0.0, 0.0, 1.0])
  
      explanation = Explanation(
          edge_mask=edge_mask,
          x=data.x,
          edge_index=data.edge_index,
          edge_attr=data.edge_attr,
      )
      explanation.validate(raise_on_error=True)
  
      out = explanation.get_explanation_subgraph()
      assert out.x.size() == (4, 3)
      assert out.edge_mask.size() == (3,)
      assert (out.edge_mask > 0.0).sum() == 3
      assert out.edge_index.size() == (2, 3)
      assert out.edge_attr.size() == (3, 3)
  
      out = explanation.get_complement_subgraph()
      assert out.x.size() == (4, 3)
      assert out.edge_mask.size() == (3,)
      assert (out.edge_mask == 0.0).sum() == 3
      assert out.edge_index.size() == (2, 3)
      assert out.edge_attr.size() == (3, 3)
  
file_path: pytorch_geometric/test/explain/test_explanation.py
imports: import os.path
  from typing import Optional, Union
  import pytest
  import torch
  from torch_geometric.data import Data
  from torch_geometric.explain import Explanation
  from torch_geometric.explain.config import MaskType
  from torch_geometric.testing import withPackage
label_desc: Use image node_id 5 for calling a global function with example usage: test_edge_mask(data) without return types