code: def test_nested_layer_choice(
      space_format: Type[ExecutableModelSpace], nn: ModuleType
  ):
      class Net(ModelSpace, label_prefix="model"):
          def __init__(self):
              super().__init__()
              self.module = LayerChoice(
                  [
                      LayerChoice(
                          [
                              nn.Conv2d(3, 3, kernel_size=1),
                              nn.Conv2d(3, 4, kernel_size=1),
                              nn.Conv2d(3, 5, kernel_size=1),
                          ]
                      ),
                      nn.Conv2d(3, 1, kernel_size=1),
                  ]
              )
  
          def forward(self, x):
              return self.module(x)
  
      model = Net()
      model = space_format.from_model(model)
      assert len(model.simplify()) == 2
  
      expect_shape_list = [1, 1, 1, 3, 4, 5]
      shape_list = []
  
      for new_model in model.grid():
          shape_list.append(
              new_model.executable_model()(
                  torch.randn(1, 3, 5, 5)
              ).size(1)
          )
      assert sorted(shape_list) == expect_shape_list
  
imports: import copy
  import random
  from types import ModuleType
  from typing import Type
  import pytest
  import nni
  import nni.nas.nn.pytorch.layers
  import nni.nas.evaluator.pytorch.lightning
  import torch
  import torch.nn.functional
  from nni.mutable import Categorical, ensure_frozen, label_scope, SampleValidationError
  from nni.nas.evaluator import FunctionalEvaluator
  from nni.nas.space import RawFormatModelSpace, SimplifiedModelSpace, ExecutableModelSpace, GraphModelSpace, model_context
  from nni.nas.space.pytorch import PytorchGraphModelSpace
  from nni.nas.nn.pytorch import ParametrizedModule, MutableModule, ModelSpace, LayerChoice, InputChoice, Cell, ChosenInputs, MutableConv2d, MutableLinear
label_desc: Use image node_id 7 for calling a global function with example usage: test_nested_layer_choice(space_format, nn) and returns: self