예제 #1
0
  def testNoShuffleDeterministic(self):
    problem = algorithmic.TinyAlgo()
    dataset = problem.dataset(mode=tf.estimator.ModeKeys.TRAIN,
                              data_dir=algorithmic.TinyAlgo.data_dir,
                              shuffle_files=False)

    tensor1 = dataset.make_one_shot_iterator().get_next()["targets"]
    tensor2 = dataset.make_one_shot_iterator().get_next()["targets"]

    with tf.Session() as sess:
      self.assertTrue(assert_tensors_equal(sess, tensor1, tensor2, 20))
예제 #2
0
 def testExperimentWithClass(self):
     exp_fn = trainer_lib.create_experiment_fn(
         "transformer",
         algorithmic.TinyAlgo(),
         algorithmic.TinyAlgo.data_dir,
         train_steps=1,
         eval_steps=1,
         min_eval_frequency=1,
         use_tpu=False)
     run_config = trainer_lib.create_run_config(
         model_dir=algorithmic.TinyAlgo.data_dir, num_gpus=0, use_tpu=False)
     hparams = registry.hparams("transformer_tiny_tpu")
     exp = exp_fn(run_config, hparams)
     exp.test()
예제 #3
0
  def testDataFilenames(self):
    problem = algorithmic.TinyAlgo()

    num_shards = 10
    shuffled = False
    data_dir = "/tmp"

    # Test training_filepaths and data_filepaths give the same list on
    # appropriate arguments.
    self.assertAllEqual(
        problem.training_filepaths(data_dir, num_shards, shuffled),
        problem.data_filepaths(problem_module.DatasetSplit.TRAIN, data_dir,
                               num_shards, shuffled))

    self.assertAllEqual(
        problem.dev_filepaths(data_dir, num_shards, shuffled),
        problem.data_filepaths(problem_module.DatasetSplit.EVAL, data_dir,
                               num_shards, shuffled))

    self.assertAllEqual(
        problem.test_filepaths(data_dir, num_shards, shuffled),
        problem.data_filepaths(problem_module.DatasetSplit.TEST, data_dir,
                               num_shards, shuffled))