class_docstr: Args:
code: def _construct_flow_model(self, base_model):
      # modify the convolution layers
      # Torch models are usually defined in a hierarchical way.
      # nn.modules.children() return all sub modules in a DFS manner
      modules = list(self.base_model.modules())
      first_conv_idx = list(
          filter(
              lambda x: isinstance(modules[x], nn.Conv2d),
              list(range(len(modules))),
          )
      )[0]
      conv_layer = modules[first_conv_idx]
      container = modules[first_conv_idx - 1]
  
      # modify parameters, assume the first blob contains the convolution kernels
      params = [x.clone() for x in conv_layer.parameters()]
      kernel_size = params[0].size()
      new_kernel_size = (
          kernel_size[:1] + (2 * self.new_length,) + kernel_size[2:]
      )
      new_kernels = (
          params[0]
          .data.mean(dim=1, keepdim=True)
          .expand(new_kernel_size)
          .contiguous()
      )
  
      new_conv = nn.Conv2d(
          2 * self.new_length,
          conv_layer.out_channels,
          conv_layer.kernel_size,
          conv_layer.stride,
          conv_layer.padding,
          bias=bool(len(params) == 2),
      )
      new_conv.weight.data = new_kernels
      if len(params) == 2:
          new_conv.bias.data = params[1].data  # add bias if neccessary
      layer_name = list(container.state_dict().keys())[0][
          :-7
      ]  # remove .weight suffix to get the layer name
  
      # replace the first convlution layer
      setattr(container, layer_name, new_conv)
  
      return 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 9 for calling the TSN obj's underlying member method code with example usage: obj._construct_flow_model(base_model) and returns: base_model