code: def _gen_hardcorenas(pretrained, variant, arch_def, **kwargs):
      """Creates a hardcorenas model
  
      Ref impl: https://github.com/Alibaba-MIIL/HardCoReNAS
      Paper: https://arxiv.org/abs/2102.11646
  
      """
      num_features = 1280
      se_layer = partial(
          SqueezeExcite,
          gate_layer="hard_sigmoid",
          force_act_layer=nn.ReLU,
          rd_round_fn=round_channels,
      )
      model_kwargs = dict(
          block_args=decode_arch_def(arch_def),
          num_features=num_features,
          stem_size=32,
          norm_layer=partial(nn.BatchNorm2d, **resolve_bn_args(kwargs)),
          act_layer=resolve_act_layer(kwargs, "hard_swish"),
          se_layer=se_layer,
          **kwargs,
      )
  
      features_only = False
      model_cls = MobileNetV3
      kwargs_filter = None
      if model_kwargs.pop("features_only", False):
          features_only = True
          kwargs_filter = (
              "num_classes",
              "num_features",
              "global_pool",
              "head_conv",
              "head_bias",
              "global_pool",
          )
          model_cls = MobileNetV3Features
      model = build_model_with_cfg(
          model_cls,
          variant,
          pretrained,
          pretrained_strict=not features_only,
          kwargs_filter=kwargs_filter,
          **model_kwargs,
      )
      if features_only:
          model.default_cfg = pretrained_cfg_for_features(
              model.default_cfg
          )
      return model
  
file_path: pytorch-image-models/timm/models/hardcorenas.py
imports: from functools import partial
  import torch.nn
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from ._builder import build_model_with_cfg
  from ._builder import pretrained_cfg_for_features
  from ._efficientnet_blocks import SqueezeExcite
  from ._efficientnet_builder import decode_arch_def, resolve_act_layer, resolve_bn_args, round_channels
  from ._registry import register_model, generate_default_cfgs
  from .mobilenetv3 import MobileNetV3, MobileNetV3Features
label_desc: Use image node_id 1 for calling a global function with example usage: _gen_hardcorenas(pretrained, variant, arch_def) and returns: model