code: def encode_seq_to_arr(seq, vocab2idx, max_seq_len):
      """
      Input:
          seq: A list of words
          output: add y_arr (torch.Tensor)
      """
  
      augmented_seq = seq[:max_seq_len] + ["__EOS__"] * max(
          0, max_seq_len - len(seq)
      )
      return torch.tensor(
          [
              [
                  vocab2idx[w]
                  if w in vocab2idx
                  else vocab2idx["__UNK__"]
                  for w in augmented_seq
              ]
          ],
          dtype=torch.long,
      )
  
file_path: ogb/examples/graphproppred/code2/utils.py
imports: import torch
  from collections import Counter
  import numpy
  import torch
label_desc: Use image node_id 4 for calling a global function with example usage: encode_seq_to_arr(seq, vocab2idx, max_seq_len) and returns: torch