code: def test_get_permutations():
      data = [list(range(3)), list(range(1)), list(range(7)), []]
      bucket_counts = [len(d) for d in data]
  
      permutation, inverse_permutation = data_io.get_permutations(
          bucket_counts
      )
      assert (
          len(permutation)
          == len(inverse_permutation)
          == len(bucket_counts)
          == len(data)
      )
  
      for d, p, pi in zip(data, permutation, inverse_permutation):
          p_set = set(p.tolist())
          pi_set = set(pi.tolist())
          assert len(p_set) == len(p)
          assert len(pi_set) == len(pi)
          assert p_set - pi_set == set()
          if d:
              d = torch.tensor(d)
              assert (d[p][pi] == d).all()
          else:
              assert len(p_set) == 1
  
imports: import os
  import random
  from tempfile import TemporaryDirectory
  from typing import Optional, List, Tuple
  import numpy
  import pytest
  import torch
  from sockeye import constants
  from sockeye import data_io
  from sockeye import utils
  from sockeye import vocab
  from sockeye.test_utils import tmp_digits_dataset
  from sockeye.utils import SockeyeError, get_tokens, seed_rngs
label_desc: Use image node_id 17 for calling a global function with example usage: test_get_permutations() without return types