code: def tensor_list_from_lists(
      lists: Sequence[Sequence[int]],
  ) -> TensorList:
      offsets = torch.tensor(
          [0] + [len(l) for l in lists], dtype=torch.long
      ).cumsum(dim=0)
      data = torch.cat(
          [torch.tensor(l, dtype=torch.long) for l in lists], dim=0
      )
      return TensorList(offsets, data)
  
file_path: PyTorch-BigGraph/test/test_entitylist.py
imports: from typing import Sequence
  from unittest import main, TestCase
  import torch
  from torchbiggraph.entitylist import EntityList
  from torchbiggraph.tensorlist import TensorList
label_desc: Use image node_id 1 for calling a global function with example usage: tensor_list_from_lists(lists) and returns: TensorList