code: def tensorize(
      self,
      texts: Optional[List[List[str]]] = None,
      tokens: Optional[List[List[List[str]]]] = None,
  ) -> Tuple[
      torch.Tensor,
      torch.Tensor,
      torch.Tensor,
      torch.Tensor,
      torch.Tensor,
  ]:
      tokens_2d: List[List[int]] = []
      start_indices_2d: List[List[int]] = []
      end_indices_2d: List[List[int]] = []
      positions_2d: List[List[int]] = []
  
      for idx in range(self.batch_size(texts, tokens)):
          numberized: Tuple[
              List[int], List[int], List[int], List[int]
          ] = self.numberize(
              self.get_texts_by_index(texts, idx),
              self.get_tokens_by_index(tokens, idx),
          )
          tokens_2d.append(numberized[0])
          start_indices_2d.append(numberized[1])
          end_indices_2d.append(numberized[2])
          positions_2d.append(numberized[3])
  
      tokens, pad_mask = pad_2d_mask(
          tokens_2d,
          pad_value=self.vocab.pad_idx,
          seq_padding_control=self.seq_padding_control,
          max_seq_pad_len=self.max_seq_len,
          batch_padding_control=self.batch_padding_control,
      )
  
      start_indices, _ = pad_2d_mask(
          start_indices_2d,
          pad_value=0,
          seq_padding_control=self.seq_padding_control,
          max_seq_pad_len=self.max_seq_len,
          batch_padding_control=self.batch_padding_control,
      )
  
      end_indices, _ = pad_2d_mask(
          end_indices_2d,
          pad_value=0,
          seq_padding_control=self.seq_padding_control,
          max_seq_pad_len=self.max_seq_len,
          batch_padding_control=self.batch_padding_control,
      )
  
      positions, _ = pad_2d_mask(
          positions_2d,
          pad_value=0,
          seq_padding_control=self.seq_padding_control,
          max_seq_pad_len=self.max_seq_len,
          batch_padding_control=self.batch_padding_control,
      )
  
      if self.device == "":
          return tokens, pad_mask, start_indices, end_indices, positions
      else:
          return (
              tokens.to(self.device),
              pad_mask.to(self.device),
              start_indices.to(self.device),
              end_indices.to(self.device),
              positions.to(self.device),
          )
  
file_path: pytext/pytext/torchscript/tensorizer/roberta.py
imports: from typing import List, Optional, Tuple
  import torch
  from pytext.torchscript.utils import pad_2d_mask
  from .bert import ScriptBERTTensorizerBase
label_desc: Use image node_id 3 for calling the ScriptRoBERTaTensorizerWithIndices obj's underlying member method code with example usage: obj.tensorize(texts, tokens) and returns: tokens,  pad_mask,  start_indices,  end_indices,  positions, tokens,  pad_mask,  start_indices,  end_indices,  positions