code: def _gen_mobilenet_v3(
      variant, channel_multiplier=1.0, pretrained=False, **kwargs
  ):
      """Creates a MobileNet-V3 large/small/minimal models.
  
      Ref impl: https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet/mobilenet_v3.py
      Paper: https://arxiv.org/abs/1905.02244
  
      Args:
        channel_multiplier: multiplier to number of channels per layer.
      """
      if "small" in variant:
          num_features = 1024
          if "minimal" in variant:
              act_layer = "relu"
              arch_def = [
                  # stage 0, 112x112 in
                  ["ds_r1_k3_s2_e1_c16"],
                  # stage 1, 56x56 in
                  ["ir_r1_k3_s2_e4.5_c24", "ir_r1_k3_s1_e3.67_c24"],
                  # stage 2, 28x28 in
                  ["ir_r1_k3_s2_e4_c40", "ir_r2_k3_s1_e6_c40"],
                  # stage 3, 14x14 in
                  ["ir_r2_k3_s1_e3_c48"],
                  # stage 4, 14x14in
                  ["ir_r3_k3_s2_e6_c96"],
                  # stage 6, 7x7 in
                  ["cn_r1_k1_s1_c576"],
              ]
          else:
              act_layer = "hard_swish"
              arch_def = [
                  # stage 0, 112x112 in
                  ["ds_r1_k3_s2_e1_c16_se0.25_nre"],  # relu
                  # stage 1, 56x56 in
                  [
                      "ir_r1_k3_s2_e4.5_c24_nre",
                      "ir_r1_k3_s1_e3.67_c24_nre",
                  ],  # relu
                  # stage 2, 28x28 in
                  [
                      "ir_r1_k5_s2_e4_c40_se0.25",
                      "ir_r2_k5_s1_e6_c40_se0.25",
                  ],  # hard-swish
                  # stage 3, 14x14 in
                  ["ir_r2_k5_s1_e3_c48_se0.25"],  # hard-swish
                  # stage 4, 14x14in
                  ["ir_r3_k5_s2_e6_c96_se0.25"],  # hard-swish
                  # stage 6, 7x7 in
                  ["cn_r1_k1_s1_c576"],  # hard-swish
              ]
      else:
          num_features = 1280
          if "minimal" in variant:
              act_layer = "relu"
              arch_def = [
                  # stage 0, 112x112 in
                  ["ds_r1_k3_s1_e1_c16"],
                  # stage 1, 112x112 in
                  ["ir_r1_k3_s2_e4_c24", "ir_r1_k3_s1_e3_c24"],
                  # stage 2, 56x56 in
                  ["ir_r3_k3_s2_e3_c40"],
                  # stage 3, 28x28 in
                  [
                      "ir_r1_k3_s2_e6_c80",
                      "ir_r1_k3_s1_e2.5_c80",
                      "ir_r2_k3_s1_e2.3_c80",
                  ],
                  # stage 4, 14x14in
                  ["ir_r2_k3_s1_e6_c112"],
                  # stage 5, 14x14in
                  ["ir_r3_k3_s2_e6_c160"],
                  # stage 6, 7x7 in
                  ["cn_r1_k1_s1_c960"],
              ]
          else:
              act_layer = "hard_swish"
              arch_def = [
                  # stage 0, 112x112 in
                  ["ds_r1_k3_s1_e1_c16_nre"],  # relu
                  # stage 1, 112x112 in
                  [
                      "ir_r1_k3_s2_e4_c24_nre",
                      "ir_r1_k3_s1_e3_c24_nre",
                  ],  # relu
                  # stage 2, 56x56 in
                  ["ir_r3_k5_s2_e3_c40_se0.25_nre"],  # relu
                  # stage 3, 28x28 in
                  [
                      "ir_r1_k3_s2_e6_c80",
                      "ir_r1_k3_s1_e2.5_c80",
                      "ir_r2_k3_s1_e2.3_c80",
                  ],  # hard-swish
                  # stage 4, 14x14in
                  ["ir_r2_k3_s1_e6_c112_se0.25"],  # hard-swish
                  # stage 5, 14x14in
                  ["ir_r3_k5_s2_e6_c160_se0.25"],  # hard-swish
                  # stage 6, 7x7 in
                  ["cn_r1_k1_s1_c960"],  # hard-swish
              ]
      with layer_config_kwargs(kwargs):
          model_kwargs = dict(
              block_args=decode_arch_def(arch_def),
              num_features=num_features,
              stem_size=16,
              channel_multiplier=channel_multiplier,
              act_layer=resolve_act_layer(kwargs, act_layer),
              se_kwargs=dict(
                  act_layer=get_act_layer("relu"),
                  gate_fn=get_act_fn("hard_sigmoid"),
                  reduce_mid=True,
                  divisor=8,
              ),
              norm_kwargs=resolve_bn_args(kwargs),
              **kwargs,
          )
          model = _create_model(model_kwargs, variant, pretrained)
      return model
  
imports: import torch.nn
  import torch.nn.functional
  from .activations import get_act_fn, get_act_layer, HardSwish
  from .config import layer_config_kwargs
  from .conv2d_layers import select_conv2d
  from .helpers import load_pretrained
  from .efficientnet_builder import *
label_desc: Use image node_id 3 for calling a global function with example usage: _gen_mobilenet_v3(variant, channel_multiplier, pretrained) and returns: model