class_docstr: This is a PyTorch implementation of the paper Disentangled Representation Learning for Text-Video Retrieval.
  Args:
      base_encoder (`str`):
          CLIP encoder backbone. default: `clip_vit_b32`
      agg_module (`str`):
          Feature aggregation module for video. default: `seqTransf`, choices=[`ndone`, `seqLSTM`, `seqTransf`]
      interaction (`str`):
          Interaction type for retrieval. default: `wti`.
      wti_arch (`int)`:
          Select a architecture for weight branch. default: 2.
      cdcr (`int`):
          Channel decorrelation regularization. default: 3.
      cdcr_alpha1 (`float`):
          Coefficient 1 for channel decorrelation regularization. default: 1.0.
      cdcr_alpha2 (`float`):
          Coefficient 2 for channel decorrelation regularization. default: 0.06.
      cdcr_lambda (`float`):
          Coefficient for channel decorrelation regularization. default: 0.001.
      cross_num_hidden_layers (`int`):
          Number of hidden layers for cross transformer interaction.
class_docstr_tok: ["This","is","a","PyTorch","implementation","of","the","paper","Disentangled","Representation","Learning","for","Text-Video","Retrieval",".","Args",":","base_encoder","(","`","str","`",")",":","CLIP","encoder","backbone",".","default",":","`","clip_vit_b32","`","agg_module","(","`","str","`",")",":","Feature","aggregation","module","for","video",".","default",":","`","seqTransf","`",",","choices=","[","`","ndone","`",",","`","seqLSTM","`",",","`","seqTransf","`","]","interaction","(","`","str","`",")",":","Interaction","type","for","retrieval",".","default",":","`","wti","`",".","wti_arch","(","`","int",")","`",":","Select","a","architecture","for","weight","branch",".","default",":","2.","cdcr","(","`","int","`",")",":","Channel","decorrelation","regularization",".","default",":","3.","cdcr_alpha1","(","`","float","`",")",":","Coefficient","1","for","channel","decorrelation","regularization",".","default",":","1.0.","cdcr_alpha2","(","`","float","`",")",":","Coefficient","2","for","channel","decorrelation","regularization",".","default",":","0.06.","cdcr_lambda","(","`","float","`",")",":","Coefficient","for","channel","decorrelation","regularization",".","default",":","0.001.","cross_num_hidden_layers","(","`","int","`",")",":","Number","of","hidden","layers","for","cross","transformer","interaction","."]
code: def aggvideo_feat(self, video_feat, video_mask, agg_module):
      video_feat = video_feat.contiguous()
      if agg_module == "ndone":
          pass
      elif agg_module == "seqLSTM":
          # Sequential type: LSTM
          video_feat_original = video_feat
          video_feat = pack_padded_sequence(
              video_feat,
              torch.sum(video_mask, dim=-1).cpu(),
              batch_first=True,
              enforce_sorted=False,
          )
          video_feat, _ = self.lstm_visual(video_feat)
          if self.training:
              self.lstm_visual.flatten_parameters()
          video_feat, _ = pad_packed_sequence(
              video_feat, batch_first=True
          )
          video_feat = torch.cat(
              (
                  video_feat,
                  video_feat_original[
                      :, video_feat.size(1) :, ...
                  ].contiguous(),
              ),
              dim=1,
          )
          video_feat = video_feat + video_feat_original
      elif agg_module == "seqTransf":
          # Sequential type: Transformer Encoder
          video_feat_original = video_feat
          seq_length = video_feat.size(1)
          position_ids = torch.arange(
              seq_length, dtype=torch.long, device=video_feat.device
          )
          position_ids = position_ids.unsqueeze(0).expand(
              video_feat.size(0), -1
          )
          frame_position_embeddings = self.frame_position_embeddings(
              position_ids
          )
          video_feat = video_feat + frame_position_embeddings
  
          extended_video_mask = (
              1.0 - video_mask.unsqueeze(1)
          ) * -1000000.0
          extended_video_mask = extended_video_mask.expand(
              -1, video_mask.size(1), -1
          )
          video_feat = video_feat.permute(1, 0, 2)  # ndLdd -> Lnddd
          video_feat = self.transformerClip(
              video_feat, extended_video_mask
          )
          video_feat = video_feat.permute(1, 0, 2)  # Lnddd -> ndLdd
          video_feat = video_feat + video_feat_original
      return video_feat
  
imports: from collections import OrderedDict
  from typing import Optional
  from types import SimpleNamespace
  import torch
  import logging
  from torch import nn
  from torch.nn.utils.rnn import pad_packed_sequence, pack_padded_sequence
  from towhee.models import clip
  from towhee.models.drl.until_module import convert_weights
  from towhee.models.drl.module_cross import CrossModel, Transformer
  from towhee.models.drl.until_module import LayerNorm, AllGather, AllGather2, CrossEn
label_desc: Use image node_id 8 for calling the DRL obj's underlying member method code with example usage: obj.aggvideo_feat(video_feat, video_mask, agg_module) and returns: video_feat