def extract_text_feat(self, texts: torch.Tensor) -> torch.Tensor:
        """The function to extract text latent features."""
        pad_index = self.tokenizer.vocab['[PAD]']
        attn_mask = texts.ne(pad_index)
        # [batch_size, seq_length, hidden_size]
        x = self.text_backbone(texts, attention_mask=attn_mask)[0]
        return x[:, 0, :] @ self.text_projection
The function to extract text latent features.
mmpretrain/models/multimodal/chinese_clip/chinese_clip.py