code: def test_proxyless_repeat_nested():
      repeat = Repeat(
          lambda index: ProxylessMixedLayer(
              {
                  name: value(3, 3, 1)
                  for name, value in OPS_WITH_STRIDE.items()
              },
              nn.Parameter(torch.randn(len(OPS_WITH_STRIDE))),
              nn.Softmax(-1),
              f"layer{index}",
          ),
          nni.choice("rep", [2, 4, 5]),
      )
      repeat = ProxylessMixedRepeat.mutate(repeat, "", {}, {})
  
      ctrl_params = []
      for m in repeat.modules():
          if isinstance(m, BaseSuperNetModule) and hasattr(
              m, "arch_parameters"
          ):
              ctrl_params += list(m.arch_parameters())
      assert len(ctrl_params) > 0
      optimizer = torch.optim.SGD(set(ctrl_params), 1e-3)
  
      for _ in range(10):
          x = torch.randn(1, 3, 9, 9).requires_grad_()
          memo = {}
          for module in repeat.modules():
              if isinstance(module, ProxylessMixedLayer):
                  memo.update(module.resample(memo))
  
          y = repeat(x).sum()
          optimizer.zero_grad(set_to_none=False)
          y.backward()
          optimizer.step()
  
      for param in ctrl_params:
          assert param.ndim == 1
          assert param.grad is not None  # Have gradient once.
  
      assert repeat.export({})["rep"] in [2, 4, 5]
  
      ops = list(OPS_WITH_STRIDE.keys())
      repeat = repeat.freeze(
          {
              "rep": 4,
              "layer0": random.choice(ops),
              "layer1": random.choice(ops),
              "layer2": random.choice(ops),
              "layer3": random.choice(ops),
          }
      )
      assert isinstance(repeat, nn.Sequential)
      assert not isinstance(
          repeat[3], ProxylessMixedLayer
      ) and isinstance(repeat[3], nn.Module)
  
imports: import random
  import pytest
  import torch
  import torch.nn
  from torch.utils.data import TensorDataset, DataLoader
  import nni
  from nni.mutable import frozen
  from nni.nas.hub.pytorch.nasbench201 import OPS_WITH_STRIDE
  from nni.nas.nn.pytorch import Repeat
  from nni.nas.oneshot.pytorch.supermodule.base import BaseSuperNetModule
  from nni.nas.oneshot.pytorch.supermodule.proxyless import ProxylessMixedLayer, ProxylessMixedInput, ProxylessMixedRepeat, _iter_tensors
  from pytorch_lightning import LightningModule, Trainer
label_desc: Use image node_id 8 for calling a global function with example usage: test_proxyless_repeat_nested() without return types