code: def _se_video_resnet_flow(
      arch, attention, pretrained=False, progress=True, **kwargs
  ):
      """Add the several SELayers to MC3_18, R3D_18, R2plus1D_18 for optical flow input."""
      model = VideoResNet(**kwargs)
      temporal_length = 16
  
      # Add channel-wise SELayer
      if attention in [
          "SELayerC",
          "SELayerCoC",
          "SELayerMC",
          "SELayerMAC",
      ]:
          se_layer = get_selayer(attention)
          model.layer1._modules["0"].add_module(attention, se_layer(64))
          model.layer1._modules["1"].add_module(attention, se_layer(64))
          model.layer2._modules["0"].add_module(
              attention, se_layer(128)
          )
          model.layer2._modules["1"].add_module(
              attention, se_layer(128)
          )
          model.layer3._modules["0"].add_module(
              attention, se_layer(256)
          )
          model.layer3._modules["1"].add_module(
              attention, se_layer(256)
          )
          model.layer4._modules["0"].add_module(
              attention, se_layer(512)
          )
          model.layer4._modules["1"].add_module(
              attention, se_layer(512)
          )
  
      # Add temporal-wise SELayer
      elif attention == "SELayerT":
          se_layer = get_selayer(attention)
          model.layer1._modules["0"].add_module(
              attention, se_layer(temporal_length // 2)
          )
          model.layer1._modules["1"].add_module(
              attention, se_layer(temporal_length // 2)
          )
          model.layer2._modules["0"].add_module(
              attention, se_layer(temporal_length // 4)
          )
          model.layer2._modules["1"].add_module(
              attention, se_layer(temporal_length // 4)
          )
  
      # Add channel-temporal-wise SELayer
      elif attention == "SELayerCT":
          model.layer1._modules["0"].add_module(
              attention + "c", SELayerC(64)
          )
          model.layer1._modules["1"].add_module(
              attention + "c", SELayerC(64)
          )
          model.layer2._modules["0"].add_module(
              attention + "c", SELayerC(128)
          )
          model.layer2._modules["1"].add_module(
              attention + "c", SELayerC(128)
          )
          model.layer3._modules["0"].add_module(
              attention + "c", SELayerC(256)
          )
          model.layer3._modules["1"].add_module(
              attention + "c", SELayerC(256)
          )
          model.layer4._modules["0"].add_module(
              attention + "c", SELayerC(512)
          )
          model.layer4._modules["1"].add_module(
              attention + "c", SELayerC(512)
          )
  
          model.layer1._modules["0"].add_module(
              attention + "t", SELayerT(temporal_length // 2)
          )
          model.layer1._modules["1"].add_module(
              attention + "t", SELayerT(temporal_length // 2)
          )
          model.layer2._modules["0"].add_module(
              attention + "t", SELayerT(temporal_length // 4)
          )
          model.layer2._modules["1"].add_module(
              attention + "t", SELayerT(temporal_length // 4)
          )
  
      # Add temporal-channel-wise SELayer
      elif attention == "SELayerTC":
          model.layer1._modules["0"].add_module(
              attention + "t", SELayerT(temporal_length // 2)
          )
          model.layer1._modules["1"].add_module(
              attention + "t", SELayerT(temporal_length // 2)
          )
          model.layer2._modules["0"].add_module(
              attention + "t", SELayerT(temporal_length // 4)
          )
          model.layer2._modules["1"].add_module(
              attention + "t", SELayerT(temporal_length // 4)
          )
  
          model.layer1._modules["0"].add_module(
              attention + "c", SELayerC(64)
          )
          model.layer1._modules["1"].add_module(
              attention + "c", SELayerC(64)
          )
          model.layer2._modules["0"].add_module(
              attention + "c", SELayerC(128)
          )
          model.layer2._modules["1"].add_module(
              attention + "c", SELayerC(128)
          )
          model.layer3._modules["0"].add_module(
              attention + "c", SELayerC(256)
          )
          model.layer3._modules["1"].add_module(
              attention + "c", SELayerC(256)
          )
          model.layer4._modules["0"].add_module(
              attention + "c", SELayerC(512)
          )
          model.layer4._modules["1"].add_module(
              attention + "c", SELayerC(512)
          )
  
      else:
          raise ValueError(
              "Wrong MODEL.ATTENTION. Current:{}".format(attention)
          )
  
      if pretrained:
          state_dict = load_state_dict_from_url(
              model_urls[arch], progress=progress
          )
          state_dict.pop("stem.0.weight")
          model.load_state_dict(state_dict, strict=False)
      return model
  
file_path: pykale/kale/embed/video_se_res3d.py
imports: from torch.hub import load_state_dict_from_url
  from kale.embed.video_res3d import BasicBlock, BasicFLowStem, BasicStem, Conv2Plus1D, Conv3DNoTemporal, Conv3DSimple, R2Plus1dFlowStem, R2Plus1dStem, VideoResNet
  from kale.embed.video_selayer import get_selayer, SELayerC, SELayerT
label_desc: Use image node_id 2 for calling a global function with example usage: _se_video_resnet_flow(arch, attention, pretrained, progress) and returns: model