Пример #1
0
    def eval_input_fn():
        source_and_target_files = list(
            zip(eval_source_files, eval_target_files))
        shuffle(source_and_target_files)
        source = tf.data.TFRecordDataset(
            [s for s, _ in source_and_target_files])
        target = tf.data.TFRecordDataset(
            [t for _, t in source_and_target_files])

        dataset = DatasetSource(source, target, hparams)
        dataset = dataset.prepare_and_zip().filter_by_max_output_length(
        ).repeat().group_by_batch(batch_size=1)
        return dataset.dataset
Пример #2
0
 def predict_input_fn():
     source = tf.data.TFRecordDataset(list(test_source_files))
     target = tf.data.TFRecordDataset(list(test_target_files))
     dataset = DatasetSource(source, target, hparams)
     batched = dataset.prepare_and_zip().filter_by_max_output_length().group_by_batch(batch_size=1)
     return batched.dataset