code: def _get_span_embeddings(
      self, input_ids, spans, token_type_ids=None, attention_mask=None
  ):
      sequence_output, pooled_output = self.albert(
          input_ids=input_ids,
          token_type_ids=token_type_ids,
          attention_mask=attention_mask,
      )
  
      sequence_output = self.hidden_dropout(sequence_output)
  
      """
          spans: [batch_size, num_spans, 3]; 0: left_ned, 1: right_end, 2: width
          spans_mask: (batch_size, num_spans, )
          """
      spans_start = spans[:, :, 0].view(spans.size(0), -1)
      spans_start_embedding = batched_index_select(
          sequence_output, spans_start
      )
      spans_end = spans[:, :, 1].view(spans.size(0), -1)
      spans_end_embedding = batched_index_select(
          sequence_output, spans_end
      )
  
      spans_width = spans[:, :, 2].view(spans.size(0), -1)
      spans_width_embedding = self.width_embedding(spans_width)
  
      spans_embedding = torch.cat(
          (
              spans_start_embedding,
              spans_end_embedding,
              spans_width_embedding,
          ),
          dim=-1,
      )
      """
          spans_embedding: (batch_size, num_spans, hidden_size*2+embedding_dim)
          """
      return spans_embedding
  
imports: import os
  import sys
  import torch
  from torch import nn
  import torch.nn.functional
  from torch.nn import CrossEntropyLoss
  from allennlp.nn.util import batched_index_select
  from allennlp.nn import util
  from allennlp.modules import FeedForward
  import numpy
  from transformers import BertTokenizer, BertPreTrainedModel, BertModel
  from transformers import AlbertTokenizer, AlbertPreTrainedModel, AlbertModel
  import os
  import json
  import logging
label_desc: Use image node_id 2 for calling the AlbertForEntity obj's underlying member method code with example usage: obj._get_span_embeddings(input_ids, spans, token_type_ids, attention_mask) and returns: spans_embedding