code: def sentence_embedding(self, text):
      encoding_dict = self.bert_tokenizer(
          text,
          max_length=self.bert_tokenizer.model_max_length,
          padding=True,
          truncation=True,
          return_tensors="pt",
      )
      input_ids = encoding_dict["input_ids"].to(self.device)
      attn_masks = encoding_dict["attention_mask"].to(self.device)
      output = self.bert_model(input_ids, attn_masks)[
          "last_hidden_state"
      ]  # b, l, h
      hidden_state = output * attn_masks.unsqueeze(-1)
      embedding = hidden_state.sum(dim=1) / attn_masks.sum(
          dim=1
      ).unsqueeze(-1)
      return embedding.detach()
  
file_path: TextBox/textbox/model/ptg.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from .pretrained_models import Pretrained_Models
  from transformers import AutoTokenizer, AutoModel
label_desc: Use image node_id 2 for calling the PTG obj's underlying member method code with example usage: obj.sentence_embedding(text) and returns: embedding