class_docstr: MobiletNet-V3
  
  Based on my EfficientNet implementation and building blocks, this model utilizes the MobileNet-v3 specific
  'efficient head', where global pooling is done before the head convolution without a final batch-norm
  layer before the classifier.
  
  Paper: `Searching for MobileNetV3` - https://arxiv.org/abs/1905.02244
  
  Other architectures utilizing MobileNet-V3 efficient head that are supported by this impl include:
    * HardCoRe-NAS - https://arxiv.org/abs/2102.11646 (defn in hardcorenas.py uses this class)
    * FBNet-V3 - https://arxiv.org/abs/2006.02049
    * LCNet - https://arxiv.org/abs/2109.15099
class_docstr_tok: ["MobiletNet-V3","Based","on","my","EfficientNet","implementation","and","building","blocks",",","this","model","utilizes","the","MobileNet-v3","specific","'efficient","head","'",",","where","global","pooling","is","done","before","the","head","convolution","without","a","final","batch-norm","layer","before","the","classifier",".","Paper",":","`","Searching","for","MobileNetV3","`","-","https",":","\/\/arxiv.org\/abs\/1905.02244","Other","architectures","utilizing","MobileNet-V3","efficient","head","that","are","supported","by","this","impl","include",":","*","HardCoRe-NAS","-","https",":","\/\/arxiv.org\/abs\/2102.11646","(","defn","in","hardcorenas.py","uses","this","class",")","*","FBNet-V3","-","https",":","\/\/arxiv.org\/abs\/2006.02049","*","LCNet","-","https",":","\/\/arxiv.org\/abs\/2109.15099"]
docstr: Args:
      block_args: Arguments for blocks of the network.
      num_classes: Number of classes for classification head.
      in_chans: Number of input image channels.
      stem_size: Number of output channels of the initial stem convolution.
      fix_stem: If True, don't scale stem by round_chs_fn.
      num_features: Number of output channels of the conv head layer.
      head_bias: If True, add a learnable bias to the conv head layer.
      pad_type: Type of padding to use for convolution layers.
      act_layer: Type of activation layer.
      norm_layer: Type of normalization layer.
      se_layer: Type of Squeeze-and-Excite layer.
      se_from_exp: If True, calculate SE channel reduction from expanded mid channels.
      round_chs_fn: Callable to round number of filters based on depth multiplier.
      drop_rate: Dropout rate.
      drop_path_rate: Stochastic depth rate.
      global_pool: Type of pooling to use for global pooling features of the FC head.
docstr_tok: ["Args",":","block_args",":","Arguments","for","blocks","of","the","network",".","num_classes",":","Number","of","classes","for","classification","head",".","in_chans",":","Number","of","input","image","channels",".","stem_size",":","Number","of","output","channels","of","the","initial","stem","convolution",".","fix_stem",":","If","True",",","do","n't","scale","stem","by","round_chs_fn",".","num_features",":","Number","of","output","channels","of","the","conv","head","layer",".","head_bias",":","If","True",",","add","a","learnable","bias","to","the","conv","head","layer",".","pad_type",":","Type","of","padding","to","use","for","convolution","layers",".","act_layer",":","Type","of","activation","layer",".","norm_layer",":","Type","of","normalization","layer",".","se_layer",":","Type","of","Squeeze-and-Excite","layer",".","se_from_exp",":","If","True",",","calculate","SE","channel","reduction","from","expanded","mid","channels",".","round_chs_fn",":","Callable","to","round","number","of","filters","based","on","depth","multiplier",".","drop_rate",":","Dropout","rate",".","drop_path_rate",":","Stochastic","depth","rate",".","global_pool",":","Type","of","pooling","to","use","for","global","pooling","features","of","the","FC","head","."]
code: def __init__(
      self,
      block_args: BlockArgs,
      num_classes: int = 1000,
      in_chans: int = 3,
      stem_size: int = 16,
      fix_stem: bool = False,
      num_features: int = 1280,
      head_bias: bool = True,
      pad_type: PadType = "",
      act_layer: Optional[LayerType] = None,
      norm_layer: Optional[LayerType] = None,
      se_layer: Optional[LayerType] = None,
      se_from_exp: bool = True,
      round_chs_fn: Callable = round_channels,
      drop_rate: float = 0.0,
      drop_path_rate: float = 0.0,
      global_pool: str = "avg",
  ):
      """
      Args:
          block_args: Arguments for blocks of the network.
          num_classes: Number of classes for classification head.
          in_chans: Number of input image channels.
          stem_size: Number of output channels of the initial stem convolution.
          fix_stem: If True, don't scale stem by round_chs_fn.
          num_features: Number of output channels of the conv head layer.
          head_bias: If True, add a learnable bias to the conv head layer.
          pad_type: Type of padding to use for convolution layers.
          act_layer: Type of activation layer.
          norm_layer: Type of normalization layer.
          se_layer: Type of Squeeze-and-Excite layer.
          se_from_exp: If True, calculate SE channel reduction from expanded mid channels.
          round_chs_fn: Callable to round number of filters based on depth multiplier.
          drop_rate: Dropout rate.
          drop_path_rate: Stochastic depth rate.
          global_pool: Type of pooling to use for global pooling features of the FC head.
      """
      super(MobileNetV3, self).__init__()
      act_layer = act_layer or nn.ReLU
      norm_layer = norm_layer or nn.BatchNorm2d
      norm_act_layer = get_norm_act_layer(norm_layer, act_layer)
      se_layer = se_layer or SqueezeExcite
      self.num_classes = num_classes
      self.num_features = num_features
      self.drop_rate = drop_rate
      self.grad_checkpointing = False
  
      # Stem
      if not fix_stem:
          stem_size = round_chs_fn(stem_size)
      self.conv_stem = create_conv2d(
          in_chans, stem_size, 3, stride=2, padding=pad_type
      )
      self.bn1 = norm_act_layer(stem_size, inplace=True)
  
      # Middle stages (IR/ER/DS Blocks)
      builder = EfficientNetBuilder(
          output_stride=32,
          pad_type=pad_type,
          round_chs_fn=round_chs_fn,
          se_from_exp=se_from_exp,
          act_layer=act_layer,
          norm_layer=norm_layer,
          se_layer=se_layer,
          drop_path_rate=drop_path_rate,
      )
      self.blocks = nn.Sequential(*builder(stem_size, block_args))
      self.feature_info = builder.features
      head_chs = builder.in_chs
  
      # Head + Pooling
      self.global_pool = SelectAdaptivePool2d(pool_type=global_pool)
      num_pooled_chs = head_chs * self.global_pool.feat_mult()
      self.conv_head = create_conv2d(
          num_pooled_chs,
          self.num_features,
          1,
          padding=pad_type,
          bias=head_bias,
      )
      self.act2 = act_layer(inplace=True)
      self.flatten = (
          nn.Flatten(1) if global_pool else nn.Identity()
      )  # don't flatten if pooling disabled
      self.classifier = (
          Linear(self.num_features, num_classes)
          if num_classes > 0
          else nn.Identity()
      )
  
      efficientnet_init_weights(self)
  
imports: from functools import partial
  from typing import Callable, List, Optional, Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.utils.checkpoint import checkpoint
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, IMAGENET_INCEPTION_MEAN, IMAGENET_INCEPTION_STD
  from timm.layers import SelectAdaptivePool2d, Linear, LayerType, PadType, create_conv2d, get_norm_act_layer
  from ._builder import build_model_with_cfg, pretrained_cfg_for_features
  from ._efficientnet_blocks import SqueezeExcite
  from ._efficientnet_builder import BlockArgs, EfficientNetBuilder, decode_arch_def, efficientnet_init_weights, round_channels, resolve_bn_args, resolve_act_layer, BN_EPS_TF_DEFAULT
  from ._features import FeatureInfo, FeatureHooks
  from ._manipulate import checkpoint_seq
  from ._registry import generate_default_cfgs, register_model, register_model_deprecations
label_desc: Use image node_id 1 to create a new MobileNetV3 object from inherited base classes: nn with example: obj = MobileNetV3(block_args, num_classes, in_chans, stem_size, fix_stem, num_features, head_bias, pad_type, act_layer, norm_layer, se_layer, se_from_exp, round_chs_fn, drop_rate, drop_path_rate, global_pool)