code: def test_getattr():
      conv2d = nn.Conv2d(1, 3, 2, 2, 0, 1)
      assert _attrs._getattr(conv2d, "in_channels") == 1
      assert _attrs._getattr(conv2d, "out_channels") == 3
      assert _attrs._getattr(conv2d, "kernel_size") == (2, 2)
      assert _attrs._getattr(
          conv2d, "kernel_size", _attrs.tuple_2_t
      ) == (2, 2)
      assert _attrs._getattr(
          conv2d, "kernel_size", _attrs.tuple_n_t[2]
      ) == (2, 2)
      assert _attrs._getattr(conv2d, "stride") == (2, 2)
      assert _attrs._getattr(conv2d, "bias", bool) == True
      assert _attrs._getattr(conv2d, "bias", int) == 1
  
      assert (
          _attrs._getattr(nn.Conv2d(1, 3, 1, bias=False), "bias", bool)
          == False
      )
  
      conv2d = nas_nn.MutableConv2d(1, 3, 2, 2, 0, 1)
      assert _attrs._getattr(conv2d, "kernel_size") == 2
      assert _attrs._getattr(
          conv2d, "kernel_size", _attrs.tuple_2_t
      ) == (2, 2)
  
      conv2d = nas_nn.MutableConv2d(1, 3, (1, 2), 2, 0, 1)
      assert _attrs._getattr(
          conv2d, "kernel_size", _attrs.tuple_2_t
      ) == (1, 2)
  
      with frozen_context():
          conv2d = nas_nn.MutableConv2d(
              1,
              3,
              Categorical([(1, 2), (2, 1), 3], label="a"),
              (2, 3),
              0,
              1,
          )
      kernel_size = _attrs._getattr(
          conv2d, "kernel_size", _attrs.tuple_2_t
      )
      assert kernel_size[0].freeze({"a": (1, 2)}) == 1
      assert kernel_size[1].freeze({"a": (1, 2)}) == 2
      assert kernel_size[0].freeze({"a": 3}) == 3
      assert kernel_size[1].freeze({"a": 3}) == 3
  
      assert _attrs._getattr(conv2d, "bias", bool) == True
  
      with frozen_context():
          conv1d = nas_nn.MutableConv1d(
              1, 3, 1, bias=Categorical([True, False], label="b")
          )
      assert (
          _attrs._getattr(conv1d, "bias", bool).freeze({"b": False})
          == False
      )
  
file_path: nni/test/ut/nas/profiler/test_utils.py
imports: import torch
  from torch import nn
  import nni
  import nni.nas.nn.pytorch
  from nni.mutable import Categorical, frozen_context
  from nni.mutable.mutable import _mutable_equal
  from nni.nas.profiler.pytorch.utils import _attrs, is_leaf_module, _expression
label_desc: Use image node_id 3 for calling a global function with example usage: test_getattr() without return types