code: def forward(self, tokens: Dict[str, torch.Tensor]) -> torch.Tensor:
      output = self.model(**tokens)
      if self.emb_type == "pooler_output":
          return output.pooler_output
      elif self.emb_type == "last_hidden_state":
          return output.last_hidden_state.mean(dim=1)
      attention_hidden_states = output.hidden_states[1:]
      if self.emb_type.startswith("hidden_state"):
          return self.hs_emb(attention_hidden_states)
      else:
          raise ValueError(
              "embedding_type needs to be one of pooler_output, "
              "last_hidden_state, hidden_state, or hidden_state_cls."
          )
  
file_path: alibi-detect/alibi_detect/models/pytorch/embedding.py
imports: from functools import partial
  import torch
  import torch.nn
  from transformers import AutoModel, AutoConfig
  from typing import Dict, List
label_desc: Use image node_id 2 for calling the TransformerEmbedding obj's underlying member method code with example usage: obj.forward(tokens) and returns: output, self, output