class_docstr: Args:
code: def _prepare_base_model(self, base_model):
      if "resnet" in base_model:
          self.base_model = getattr(torchvision.models, base_model)(
              bool(self.pretrain == "imagenet")
          )
          if self.is_shift:
              make_temporal_shift(
                  self.base_model,
                  self.num_segments,
                  n_div=self.shift_div,
                  place=self.shift_place,
                  temporal_pool=self.temporal_pool,
              )
  
          if self.non_local:
              make_non_local(self.base_model, self.num_segments)
  
          self.base_model.last_layer_name = "fc"
          self.input_size = 224
          self.input_mean = [0.485, 0.456, 0.406]
          self.input_std = [0.229, 0.224, 0.225]
  
          self.base_model.avgpool = nn.AdaptiveAvgPool2d(1)
  
          if self.modality == "Flow":
              self.input_mean = [0.5]
              self.input_std = [np.mean(self.input_std)]
          elif self.modality == "RGBDiff":
              self.input_mean = [0.485, 0.456, 0.406] + [
                  0
              ] * 3 * self.new_length
              self.input_std = (
                  self.input_std
                  + [np.mean(self.input_std) * 2] * 3 * self.new_length
              )
  
      elif base_model == "mobilenetv2":
          self.base_model = mobilenet_v2(
              bool(self.pretrain == "imagenet")
          )
  
          self.base_model.last_layer_name = "classifier"
          self.input_size = 224
          self.input_mean = [0.485, 0.456, 0.406]
          self.input_std = [0.229, 0.224, 0.225]
  
          self.base_model.avgpool = nn.AdaptiveAvgPool2d(1)
          if self.is_shift:
              for m in self.base_model.modules():
                  if (
                      isinstance(m, InvertedResidual)
                      and len(m.conv) == 8
                      and m.use_res_connect
                  ):
                      m.conv[0] = TemporalShift(
                          m.conv[0],
                          n_segment=self.num_segments,
                          n_div=self.shift_div,
                      )
          if self.modality == "Flow":
              self.input_mean = [0.5]
              self.input_std = [np.mean(self.input_std)]
          elif self.modality == "RGBDiff":
              self.input_mean = [0.485, 0.456, 0.406] + [
                  0
              ] * 3 * self.new_length
              self.input_std = (
                  self.input_std
                  + [np.mean(self.input_std) * 2] * 3 * self.new_length
              )
      else:
          raise ValueError("Unknown base model: {}".format(base_model))
  
imports: import torch
  from torch import nn
  from torch.nn.init import normal_, constant_
  import numpy
  import torchvision
  from towhee.models.utils.basic_ops import ConsensusModule
  from towhee.models.layers.non_local import make_non_local
  from towhee.models.tsm.mobilenet_v2 import mobilenet_v2, InvertedResidual
  from towhee.models.tsm.temporal_shift import TemporalShift, make_temporal_shift
  from towhee.models.tsm.config import _C
label_desc: Use image node_id 3 for calling the TSN obj's underlying member method code with example usage: obj._prepare_base_model(base_model) without return types