code: def test_repeat_propagate_is_leaf():
      class Poisonous(nn.Module):
          def forward(self, x):
              return x
  
          def _shape_forward(self, x):
              raise RuntimeError("should not be called")
  
      class InnerNet(nn.Module):
          def __init__(self):
              super().__init__()
              self.poisonous = Poisonous()
  
          def forward(self, x):
              return self.poisonous(x)
  
          def _shape_forward(self, x):
              return x.real_shape
  
      class OuterNet(ModelSpace):
          def __init__(self):
              super().__init__()
              self.choice = Repeat(InnerNet(), (1, 2), label="rep")
  
          def forward(self, x):
              return self.choice(x)
  
      with pytest.raises(RuntimeError, match="should not be called"):
          submodule_input_output_shapes(
              OuterNet(), ShapeTensor(torch.randn(3), True)
          )
  
      def is_leaf(module):
          return isinstance(module, InnerNet)
  
      results = submodule_input_output_shapes(
          OuterNet(), ShapeTensor(torch.randn(3), True), is_leaf=is_leaf
      )
      assert set(results.keys()) == {
          "",
          "choice",
          "choice.blocks.0",
          "choice.blocks.1",
      }
  
      InnerNet = profiler_leaf_module(InnerNet)
      results = submodule_input_output_shapes(
          OuterNet(), ShapeTensor(torch.randn(3), True)
      )
      assert set(results.keys()) == {
          "",
          "choice",
          "choice.blocks.0",
          "choice.blocks.1",
      }
  
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 26 for calling a global function with example usage: test_repeat_propagate_is_leaf() and returns: isinstance, x, self, x, self