code: def test_parametrized_module():
      class MyModule(ParametrizedModule):
          def __init__(self, x):
              super().__init__()
              self.t = x
  
      with frozen_context():
          module = MyModule(nni.choice("choice1", [1, 2, 3]))
      assert module.t == 1
      assert module.args["x"].label == "choice1"
  
      assert (
          repr(module)
          == "MyModule(x=Categorical([1, 2, 3], label='choice1'))"
      )
      assert str(module) == repr(module)
  
      class ParametrizedConv2d(
          ParametrizedModule, nn.Conv2d, wraps=nn.Conv2d
      ):
          pass
  
      with pytest.raises(RuntimeError):
          ParametrizedConv2d(3, nni.choice("out", [8, 16]), 1)
  
      with frozen_context():
          conv = ParametrizedConv2d(3, nni.choice("out", [8, 16]), 1)
  
      assert (
          repr(conv)
          == "ParametrizedConv2d(in_channels=3, out_channels=Categorical([8, 16], label='out'), kernel_size=1)"
      )
      assert conv.out_channels == 8
      assert conv.args["padding"] == 0
      assert _mutable_equal(
          conv.args["out_channels"], nni.choice("out", [8, 16])
      )
      assert conv.contains({"out": 16})
      assert len(conv.simplify()) == 1
      assert type(conv.freeze({"out": 16})) is nn.Conv2d
      assert conv.freeze({"out": 16}).out_channels == 16
  
imports: import copy
  import pytest
  import torch
  import nni
  from torch import nn
  from nni.common.serializer import is_traceable
  from nni.mutable import Categorical, ExpressionConstraint, ensure_frozen, frozen_context, label_scope, auto_label, SampleMissingError
  from nni.mutable.mutable import _mutable_equal
  from nni.nas.nn.pytorch import ModelSpace, MutableModule, ParametrizedModule
  from nni.nas.space import model_context
label_desc: Use image node_id 20 for calling a global function with example usage: test_parametrized_module() without return types