def __call__(self,
                 subtoken_ids_batch: Collection[Collection[int]],
                 startofwords_batch: Collection[Collection[int]],
                 attention_batch: Collection[Collection[int]]) -> Tuple[Collection[Collection[Collection[float]]],
                                                                        Collection[Collection[Collection[float]]],
                                                                        Collection[Collection[float]],
                                                                        Collection[Collection[float]],
                                                                        Collection[Collection[float]]]:
        """Predict embeddings values for a given batch

        Args:
            subtoken_ids_batch: padded indexes for every subtoken
            startofwords_batch: a mask matrix with ``1`` for every first subtoken init in a token and ``0``
                for every other subtoken
            attention_batch: a mask matrix with ``1`` for every significant subtoken and ``0`` for paddings
        """
        ids_tensor = torch.tensor(subtoken_ids_batch, device=self.device, dtype=torch.long)
        startofwords_tensor = torch.tensor(startofwords_batch, device=self.device).bool()
        attention_tensor = torch.tensor(attention_batch, device=self.device)
        with torch.no_grad():
            output = self.model(ids_tensor, attention_tensor)
            last_hidden = output.last_hidden_state
            pooler_output = output.pooler_output
            attention_tensor = attention_tensor.unsqueeze(-1)
            max_emb = torch.max(last_hidden - 1e9 * (1 - attention_tensor), dim=1)[0]
            subword_emb = last_hidden * attention_tensor
            mean_emb = torch.sum(subword_emb, dim=1) / torch.sum(attention_tensor, dim=1)

            tokens_lengths = startofwords_tensor.sum(dim=1)
            word_emb = torch.zeros((subword_emb.shape[0], tokens_lengths.max(), subword_emb.shape[2]),
                                   device=self.device, dtype=subword_emb.dtype)
            target_indexes = (torch.arange(word_emb.shape[1], device=self.device).expand(word_emb.shape[:-1]) <
                              tokens_lengths.unsqueeze(-1))
            word_emb[target_indexes] = subword_emb[startofwords_tensor]

        subword_emb = subword_emb.cpu().numpy()
        word_emb = word_emb.cpu().numpy()
        pooler_output = pooler_output.cpu().numpy()
        max_emb = max_emb.cpu().numpy()
        mean_emb = mean_emb.cpu().numpy()
        if self.truncate:
            subword_emb = [item[:mask.sum()] for item, mask in zip(subword_emb, attention_batch)]
            word_emb = [item[:mask.sum()] for item, mask in zip(word_emb, startofwords_batch)]
        return word_emb, subword_emb, max_emb, mean_emb, pooler_output
Predict embeddings values for a given batch

        Args:
            subtoken_ids_batch: padded indexes for every subtoken
            startofwords_batch: a mask matrix with ``1`` for every first subtoken init in a token and ``0``
                for every other subtoken
            attention_batch: a mask matrix with ``1`` for every significant subtoken and ``0`` for paddings
        
deeppavlov/models/embedders/transformers_embedder.py