def test_get_dataset_both_train_and_validation_splits(self):
    mixture_or_task_name = 'both_train_and_validation_splits'
    x_train = [{'inputs': [7, 8, 5, 6, 9, 4, 3], 'targets': [3, 9]}]
    x_val = [{'inputs': [8, 4], 'targets': [4]}]
    datasets = {'train': create_default_dataset(x_train), 'validation': create_default_dataset(x_val)}
    dataset_fn = (lambda split, shuffle_files: datasets[split])
    register_dummy_task(mixture_or_task_name, dataset_fn=dataset_fn)
    task_feature_lengths = {'inputs': 7, 'targets': 5}
    output_ds = {}
    for split in ['train', 'validation']:
        converter = feature_converters.EncDecFeatureConverter(pack=False)
        output_ds[split] = dataset_providers.get_dataset(mixture_or_task_name=mixture_or_task_name, task_feature_lengths=task_feature_lengths, dataset_split=split, shuffle=False, feature_converter=converter)
    expected_train = {'encoder_input_tokens': [7, 8, 5, 6, 9, 4, 1], 'decoder_target_tokens': [3, 9, 1, 0, 0], 'decoder_input_tokens': [0, 3, 9, 1, 0], 'decoder_loss_weights': [1, 1, 1, 0, 0]}
    expected_val = {'encoder_input_tokens': [8, 4, 1, 0, 0, 0, 0], 'decoder_target_tokens': [4, 1, 0, 0, 0], 'decoder_input_tokens': [0, 4, 1, 0, 0], 'decoder_loss_weights': [1, 1, 0, 0, 0]}
    expected_dtypes = {feat: tf.int32 for feat in expected_train.keys()}
    assert_dataset(output_ds['train'], expected_train, expected_dtypes=expected_dtypes)
    assert_dataset(output_ds['validation'], expected_val, expected_dtypes=expected_dtypes)
def test_get_dataset_both_train_and_validation_splits(self):
    mixture_or_task_name = 'both_train_and_validation_splits'
    x_train = [{'inputs': [7, 8, 5, 6, 9, 4, 3], 'targets': [3, 9]}]
    x_val = [{'inputs': [8, 4], 'targets': [4]}]
    datasets = {'train': create_default_dataset(x_train), 'validation': create_default_dataset(x_val)}
    dataset_fn = (lambda split, shuffle_files: datasets[split])
    register_dummy_task(mixture_or_task_name, dataset_fn=dataset_fn)
    task_feature_lengths = {'inputs': 7, 'targets': 5}
    output_ds = {}
    for split in ['train', 'validation']:
        converter = feature_converters.EncDecFeatureConverter(pack=False)
        output_ds[split] = dataset_providers.get_dataset(mixture_or_task_name=mixture_or_task_name, task_feature_lengths=task_feature_lengths, dataset_split=split, shuffle=False, feature_converter=converter)
    expected_train = {'encoder_input_tokens': [7, 8, 5, 6, 9, 4, 1], 'decoder_target_tokens': [3, 9, 1, 0, 0], 'decoder_input_tokens': [0, 3, 9, 1, 0], 'decoder_loss_weights': [1, 1, 1, 0, 0]}
    expected_val = {'encoder_input_tokens': [8, 4, 1, 0, 0, 0, 0], 'decoder_target_tokens': [4, 1, 0, 0, 0], 'decoder_input_tokens': [0, 4, 1, 0, 0], 'decoder_loss_weights': [1, 1, 0, 0, 0]}
    expected_dtypes = {feat: tf.int32 for feat in expected_train.keys()}
    assert_dataset(output_ds['train'], expected_train, expected_dtypes=expected_dtypes)
    assert_dataset(output_ds['validation'], expected_val, expected_dtypes=expected_dtypes)