def sequence_length(self, dataset_split):
    """Only generate sequences with even lengths.

    Args:
      dataset_split: A problem.DatasetSplit specifying which dataset the
        sequence is a part of.

    Returns:
      An even number >= min_sequence_length(dataset_split)
        and <= max_sequence_length(dataset_split)
    """
    min_length = self.min_sequence_length(dataset_split)
    min_length += min_length % 2
    max_length = self.max_sequence_length(dataset_split)
    max_length -= max_length % 2
    length = random.randint(min_length, max_length)
    return length - (length % 2)
Only generate sequences with even lengths.

    Args:
      dataset_split: A problem.DatasetSplit specifying which dataset the
        sequence is a part of.

    Returns:
      An even number >= min_sequence_length(dataset_split)
        and <= max_sequence_length(dataset_split)
    
tensor2tensor/data_generators/transduction_problems.py