code: def test_error_message(caplog):
      class Net(nn.Module):
          def forward(self, x):
              return torch.stft(x, 4, return_complex=True)
  
      input = ShapeTensor(torch.randn(10, 8), True)
      with pytest.raises(
          RuntimeError,
          match="Shape inference failed because no shape inference formula",
      ):
          shape_inference(Net(), input)
  
      assert (
          "Shape information is not explicitly propagated when executing"
          in caplog.text
      )
      assert "  - '' (type: " in caplog.text
      caplog.clear()
  
      _shape._current_module_names = []
  
      class Net1(nn.Module):
          def __init__(self):
              super().__init__()
              self.inner = Net()
  
          def forward(self, x):
              return self.inner(x)
  
      input = ShapeTensor(torch.randn(10, 8), True)
      with pytest.raises(
          RuntimeError,
          match="Shape inference failed because no shape inference formula",
      ):
          shape_inference(Net1(), input)
  
      assert (
          "Shape information is not explicitly propagated when executing"
          in caplog.text
      )
      assert "  - 'inner' (type: " in caplog.text
      assert "  - '' (type: " in caplog.text
  
      _shape._current_module_names = []
  
      caplog.clear()
  
      Net1._shape_forward = lambda self, x: x
  
      with pytest.raises(
          RuntimeError,
          match="Shape inference failed because no shape inference formula",
      ):
          submodule_input_output_shapes(Net1(), input)
      assert (
          "Shape information is not explicitly propagated when executing"
          in caplog.text
      )
      assert "  - 'inner' (type: " in caplog.text
  
imports: import torch
  import torch.nn.functional
  from torch import nn
  import pytest
  import nni
  import nni.nas.profiler.pytorch.utils.shape
  from nni.mutable import MutableList, Categorical
  from nni.nas.nn.pytorch import MutableLinear, MutableConv2d, MutableDropout, MutableMultiheadAttention, ModelSpace, LayerChoice, InputChoice, Repeat
  from nni.nas.profiler.pytorch.utils import shape_inference, submodule_input_output_shapes, ShapeTensor, MutableShape, profiler_leaf_module
label_desc: Use image node_id 6 for calling a global function with example usage: test_error_message(caplog) and returns: torch, self