def generator(self, base, max_length, nbr_cases):
    'Generator for the multiplication task.\n\n    The length of each number is drawn uniformly at random in [1, max_length/2]\n    and then digits are drawn uniformly at random. The numbers are multiplied\n    and separated by [base] in the input. Stops at nbr_cases.\n\n    Args:\n      base: in which base are the numbers.\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      input-list are the 2 numbers and target-list is the result of multiplying\n      them.\n\n    Raises:\n      ValueError: if max_length is lower than 3.\n    '
    if (max_length < 3):
        raise ValueError('Maximum length must be at least 3.')
    for _ in range(nbr_cases):
        l1 = (np.random.randint((max_length // 2)) + 1)
        l2 = (np.random.randint(((max_length - l1) - 1)) + 1)
        n1 = random_number_lower_endian(l1, base)
        n2 = random_number_lower_endian(l2, base)
        result = (lower_endian_to_number(n1, base) * lower_endian_to_number(n2, base))
        inputs = ((n1 + [base]) + n2)
        targets = number_to_lower_endian(result, base)
        (yield {'inputs': inputs, 'targets': targets})
Generator for the multiplication task.

The length of each number is drawn uniformly at random in [1, max_length/2]
and then digits are drawn uniformly at random. The numbers are multiplied
and separated by [base] in the input. Stops at nbr_cases.

Args:
  base: in which base are the numbers.
  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
  input-list are the 2 numbers and target-list is the result of multiplying
  them.

Raises:
  ValueError: if max_length is lower than 3.
def generator(self, base, max_length, nbr_cases):
    'Generator for the multiplication task.\n\n    The length of each number is drawn uniformly at random in [1, max_length/2]\n    and then digits are drawn uniformly at random. The numbers are multiplied\n    and separated by [base] in the input. Stops at nbr_cases.\n\n    Args:\n      base: in which base are the numbers.\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      input-list are the 2 numbers and target-list is the result of multiplying\n      them.\n\n    Raises:\n      ValueError: if max_length is lower than 3.\n    '
    if (max_length < 3):
        raise ValueError('Maximum length must be at least 3.')
    for _ in range(nbr_cases):
        l1 = (np.random.randint((max_length // 2)) + 1)
        l2 = (np.random.randint(((max_length - l1) - 1)) + 1)
        n1 = random_number_lower_endian(l1, base)
        n2 = random_number_lower_endian(l2, base)
        result = (lower_endian_to_number(n1, base) * lower_endian_to_number(n2, base))
        inputs = ((n1 + [base]) + n2)
        targets = number_to_lower_endian(result, base)
        (yield {'inputs': inputs, 'targets': targets})