def get_representation(
        self,
        sentences,
        pool="last",
        tokenize=False,
        return_numpy=True,
        add_start_end=True,
    ):
        """Get model representations.

        Args:
            sentences(list): Sentences to get embeddings.
            pool(str): Type of getting hidden state.
            tokenize(bool): To tokenize or not.
            return_numpy(bool): To return a numpy array or not.
            add_start_end(bool): To add start and end notation (<s> </s>) to each
            sentence or not.

        Returns:
            torch.Tensor : Return last or all hidden states.

        """

        minibatch = self.get_minibatch(
            sentences, tokenize=tokenize, add_start_end=add_start_end
        )
        h, h_t = self.encoder(
            input=minibatch["sentences"],
            lengths=minibatch["lengths"],
            return_all=True,
            pool=pool,
        )
        h = h.index_select(0, minibatch["rev"])
        h_t = h_t.index_select(0, minibatch["rev"])
        if return_numpy:
            return h.data.cpu().numpy(), h_t.data.cpu().numpy()
        else:
            return h, h_t
Get model representations.

        Args:
            sentences(list): Sentences to get embeddings.
            pool(str): Type of getting hidden state.
            tokenize(bool): To tokenize or not.
            return_numpy(bool): To return a numpy array or not.
            add_start_end(bool): To add start and end notation (<s> </s>) to each
            sentence or not.

        Returns:
            torch.Tensor : Return last or all hidden states.

        
utils_nlp/models/gensen/gensen.py