class_docstr: MobileNetV3 Feature Extractor
  
  A work-in-progress feature extraction module for MobileNet-V3 to use as a backbone for segmentation
  and object detection models.
class_docstr_tok: ["MobileNetV3","Feature","Extractor","A","work-in-progress","feature","extraction","module","for","MobileNet-V3","to","use","as","a","backbone","for","segmentation","and","object","detection","models","."]
docstr: Args:
      block_args: Arguments for blocks of the network.
      out_indices: Output from stages at indices.
      feature_location: Location of feature before/after each block, must be in ['bottleneck', 'expansion']
      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.
      output_stride: Output stride of the network.
      pad_type: Type of padding to use for convolution layers.
      round_chs_fn: Callable to round number of filters based on depth multiplier.
      se_from_exp: If True, calculate SE channel reduction from expanded mid channels.
      act_layer: Type of activation layer.
      norm_layer: Type of normalization layer.
      se_layer: Type of Squeeze-and-Excite layer.
      drop_rate: Dropout rate.
      drop_path_rate: Stochastic depth rate.
docstr_tok: ["Args",":","block_args",":","Arguments","for","blocks","of","the","network",".","out_indices",":","Output","from","stages","at","indices",".","feature_location",":","Location","of","feature","before\/after","each","block",",","must","be","in","[","'bottleneck","'",",","'expansion","'","]","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",".","output_stride",":","Output","stride","of","the","network",".","pad_type",":","Type","of","padding","to","use","for","convolution","layers",".","round_chs_fn",":","Callable","to","round","number","of","filters","based","on","depth","multiplier",".","se_from_exp",":","If","True",",","calculate","SE","channel","reduction","from","expanded","mid","channels",".","act_layer",":","Type","of","activation","layer",".","norm_layer",":","Type","of","normalization","layer",".","se_layer",":","Type","of","Squeeze-and-Excite","layer",".","drop_rate",":","Dropout","rate",".","drop_path_rate",":","Stochastic","depth","rate","."]
code: def __init__(
      self,
      block_args: BlockArgs,
      out_indices: Tuple[int, ...] = (0, 1, 2, 3, 4),
      feature_location: str = "bottleneck",
      in_chans: int = 3,
      stem_size: int = 16,
      fix_stem: bool = False,
      output_stride: int = 32,
      pad_type: PadType = "",
      round_chs_fn: Callable = round_channels,
      se_from_exp: bool = True,
      act_layer: Optional[LayerType] = None,
      norm_layer: Optional[LayerType] = None,
      se_layer: Optional[LayerType] = None,
      drop_rate: float = 0.0,
      drop_path_rate: float = 0.0,
  ):
      """
      Args:
          block_args: Arguments for blocks of the network.
          out_indices: Output from stages at indices.
          feature_location: Location of feature before/after each block, must be in ['bottleneck', 'expansion']
          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.
          output_stride: Output stride of the network.
          pad_type: Type of padding to use for convolution layers.
          round_chs_fn: Callable to round number of filters based on depth multiplier.
          se_from_exp: If True, calculate SE channel reduction from expanded mid channels.
          act_layer: Type of activation layer.
          norm_layer: Type of normalization layer.
          se_layer: Type of Squeeze-and-Excite layer.
          drop_rate: Dropout rate.
          drop_path_rate: Stochastic depth rate.
      """
      super(MobileNetV3Features, self).__init__()
      act_layer = act_layer or nn.ReLU
      norm_layer = norm_layer or nn.BatchNorm2d
      se_layer = se_layer or SqueezeExcite
      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_layer(stem_size)
      self.act1 = act_layer(inplace=True)
  
      # Middle stages (IR/ER/DS Blocks)
      builder = EfficientNetBuilder(
          output_stride=output_stride,
          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,
          feature_location=feature_location,
      )
      self.blocks = nn.Sequential(*builder(stem_size, block_args))
      self.feature_info = FeatureInfo(builder.features, out_indices)
      self._stage_out_idx = {
          f["stage"]: f["index"] for f in self.feature_info.get_dicts()
      }
  
      efficientnet_init_weights(self)
  
      # Register feature extraction hooks with FeatureHooks helper
      self.feature_hooks = None
      if feature_location != "bottleneck":
          hooks = self.feature_info.get_dicts(
              keys=("module", "hook_type")
          )
          self.feature_hooks = FeatureHooks(hooks, self.named_modules())
  
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 MobileNetV3Features object from inherited base classes: nn with example: obj = MobileNetV3Features(block_args, out_indices, feature_location, in_chans, stem_size, fix_stem, output_stride, pad_type, round_chs_fn, se_from_exp, act_layer, norm_layer, se_layer, drop_rate, drop_path_rate)