code: def __init__(
      self, config: MobileNetV1Config, add_pooling_layer: bool = True
  ):
      super().__init__(config)
      self.config = config
  
      depth = 32
      out_channels = max(
          int(depth * config.depth_multiplier), config.min_depth
      )
  
      self.conv_stem = MobileNetV1ConvLayer(
          config,
          in_channels=config.num_channels,
          out_channels=out_channels,
          kernel_size=3,
          stride=2,
      )
  
      strides = [1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1]
  
      self.layer = nn.ModuleList()
      for i in range(13):
          in_channels = out_channels
  
          if strides[i] == 2 or i == 0:
              depth *= 2
              out_channels = max(
                  int(depth * config.depth_multiplier), config.min_depth
              )
  
          self.layer.append(
              MobileNetV1ConvLayer(
                  config,
                  in_channels=in_channels,
                  out_channels=in_channels,
                  kernel_size=3,
                  stride=strides[i],
                  groups=in_channels,
              )
          )
  
          self.layer.append(
              MobileNetV1ConvLayer(
                  config,
                  in_channels=in_channels,
                  out_channels=out_channels,
                  kernel_size=1,
              )
          )
  
      self.pooler = (
          nn.AdaptiveAvgPool2d((1, 1)) if add_pooling_layer else None
      )
  
      # Initialize weights and apply final processing
      self.post_init()
  
imports: from typing import Optional, Union
  import torch
  from torch import nn
  from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
  from ...activations import ACT2FN
  from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging
  from .configuration_mobilenet_v1 import MobileNetV1Config
label_desc: Use image node_id 1 to create a new MobileNetV1Model object from inherited base classes: MobileNetV1PreTrainedModel with example: obj = MobileNetV1Model(config, add_pooling_layer)