class_docstr: EncImg module
class_docstr_tok: ["EncImg","module"]
code: def forward(self, img):
      bb, tt, _, hh, ww = img.shape
      h, w = hh // 32, ww // 32
  
      img = torchvision.transforms.Normalize(
          [0.485, 0.456, 0.406], [0.229, 0.224, 0.225]
      )(img)
  
      f_img = self.swin(img.transpose(1, 2)).transpose(1, 2)
  
      f_img = f_img.permute(0, 1, 3, 4, 2).view([bb, tt, h * w, 768])
      f_img = torch.cat(
          [self.emb_cls.expand([bb, tt, -1, -1]), f_img], dim=2
      )
      f_img += (
          self.emb_pos.expand([bb, tt, -1, -1])[:, :, : 1 + h * w, :]
          + self.emb_len.expand([bb, -1, 1 + h * w, -1])[:, :tt, :, :]
      )
      f_img = self.norm(f_img).view([bb, tt * (1 + h * w), -1])
  
      m_img = torch.ones(1 + h * w).long().unsqueeze(0).unsqueeze(0)
      m_img = (
          m_img.expand([bb, tt, -1])
          .contiguous()
          .view([bb, tt * (1 + h * w)])
      )
  
      return f_img, m_img
  
file_path: towhee/towhee/models/violet/violet.py
imports: import torch
  import os
  from towhee.models.video_swin_transformer.video_swin_transformer import VideoSwinTransformer
label_desc: Use image node_id 2 for calling the EncImg obj's underlying member method code with example usage: obj.forward(img) and returns: f_img,  m_img