def generator(self, nbr_symbols, max_length, nbr_cases):
    'Generating for sorting task on sequence of symbols.\n\n    The length of the sequence is drawn uniformly at random from [1, max_length]\n    and then symbols are drawn (uniquely w/ or w/o replacement) uniformly at\n    random from [0, nbr_symbols) until nbr_cases sequences have been produced.\n\n    Args:\n      nbr_symbols: number of symbols to use in each sequence.\n      max_length: integer, maximum length of sequences to generate.\n      nbr_cases: the number of cases to generate.\n\n    Yields:\n      A dictionary {"inputs": input-list, "targets": target-list} where\n      target-list is input-list sorted.\n    '
    for _ in range(nbr_cases):
        length = (np.random.randint(max_length) + 1)
        if self.unique:
            inputs = np.arange(nbr_symbols)
            np.random.shuffle(inputs)
            inputs = inputs[:length]
            inputs = list(inputs)
        else:
            inputs = list(np.random.randint(nbr_symbols, size=length))
        targets = list(sorted(inputs))
        (yield {'inputs': inputs, 'targets': targets})
Generating for sorting task on sequence of symbols.

The length of the sequence is drawn uniformly at random from [1, max_length]
and then symbols are drawn (uniquely w/ or w/o replacement) uniformly at
random from [0, nbr_symbols) until nbr_cases sequences have been produced.

Args:
  nbr_symbols: number of symbols to use in each sequence.
  max_length: integer, maximum length of sequences to generate.
  nbr_cases: the number of cases to generate.

Yields:
  A dictionary {"inputs": input-list, "targets": target-list} where
  target-list is input-list sorted.
def generator(self, nbr_symbols, max_length, nbr_cases):
    'Generating for sorting task on sequence of symbols.\n\n    The length of the sequence is drawn uniformly at random from [1, max_length]\n    and then symbols are drawn (uniquely w/ or w/o replacement) uniformly at\n    random from [0, nbr_symbols) until nbr_cases sequences have been produced.\n\n    Args:\n      nbr_symbols: number of symbols to use in each sequence.\n      max_length: integer, maximum length of sequences to generate.\n      nbr_cases: the number of cases to generate.\n\n    Yields:\n      A dictionary {"inputs": input-list, "targets": target-list} where\n      target-list is input-list sorted.\n    '
    for _ in range(nbr_cases):
        length = (np.random.randint(max_length) + 1)
        if self.unique:
            inputs = np.arange(nbr_symbols)
            np.random.shuffle(inputs)
            inputs = inputs[:length]
            inputs = list(inputs)
        else:
            inputs = list(np.random.randint(nbr_symbols, size=length))
        targets = list(sorted(inputs))
        (yield {'inputs': inputs, 'targets': targets})