code: def test_explain_message():
      x = torch.randn(4, 8)
      edge_index = torch.tensor([[0, 1, 2, 3], [0, 0, 1, 1]])
  
      conv = MyExplainConv()
      conv.explain = True
      assert conv.propagate.__module__.endswith("message_passing")
  
      with pytest.raises(ValueError, match="pre-defined 'edge_mask'"):
          conv(x, edge_index)
  
      conv._edge_mask = torch.tensor([0.0, 0.0, 0.0, 0.0])
      conv._apply_sigmoid = False
      assert conv(x, edge_index).abs().sum() == 0.0
  
      conv._edge_mask = torch.tensor([1.0, 1.0, 1.0, 1.0])
      conv._apply_sigmoid = False
      out1 = conv(x, edge_index)
  
      # TorchScript should still work since it relies on class methods
      # (but without explainability).
      torch.jit.script(conv)
  
      conv.explain = False
      assert conv.propagate.__module__.endswith(
          "MyExplainConv_propagate"
      )
      out2 = conv(x, edge_index)
      assert torch.allclose(out1, out2)
  
imports: import copy
  from typing import Tuple, Union
  import pytest
  import torch
  from torch import Tensor
  from torch.nn import Linear
  import torch_geometric.typing
  from torch_geometric.nn import MessagePassing, aggr
  from torch_geometric.typing import Adj, OptPairTensor, OptTensor, Size, SparseTensor
  from torch_geometric.utils import add_self_loops, scatter, spmm, to_torch_csc_tensor
label_desc: Use image node_id 16 for calling a global function with example usage: test_explain_message() without return types