code: def test():
      seq_list = [
          ["a", "b"],
          ["a", "b", "c", "df", "f", "2edea", "a"],
          ["eraea", "a", "c"],
          ["d"],
          ["4rq4f", "f", "a", "a", "g"],
      ]
      vocab2idx, idx2vocab = get_vocab_mapping(seq_list, 4)
      print(vocab2idx)
      print(idx2vocab)
      print()
      assert len(vocab2idx) == len(idx2vocab)
  
      for vocab, idx in vocab2idx.items():
          assert idx2vocab[idx] == vocab
  
      for seq in seq_list:
          print(seq)
          arr = encode_seq_to_arr(seq, vocab2idx, max_seq_len=4)[0]
          # Test the effect of predicting __EOS__
          # arr[2] = vocab2idx['__EOS__']
          print(arr)
          seq_dec = decode_arr_to_seq(arr, idx2vocab)
  
          print(arr)
          print(seq_dec)
          print("")
  
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 6 for calling a global function with example usage: test() without return types