Exemple #1
0
 def _setup(self):
   tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.DEBUG)
   if EstimatorCifar10BenchmarkTests.local_flags is None:
     cifar_main.define_cifar_flags()
     # Loads flags to get defaults to then override.
     flags.FLAGS(['foo'])
     saved_flag_values = flagsaver.save_flag_values()
     EstimatorCifar10BenchmarkTests.local_flags = saved_flag_values
     return
   flagsaver.restore_flag_values(EstimatorCifar10BenchmarkTests.local_flags)
 def _setup(self):
     """Setups up and resets flags before each test."""
     tf.logging.set_verbosity(tf.logging.DEBUG)
     if KerasCifar10BenchmarkTests.local_flags is None:
         keras_common.define_keras_flags()
         cifar_main.define_cifar_flags()
         # Loads flags to get defaults to then override. List cannot be empty.
         flags.FLAGS(['foo'])
         saved_flag_values = flagsaver.save_flag_values()
         KerasCifar10BenchmarkTests.local_flags = saved_flag_values
         return
     flagsaver.restore_flag_values(KerasCifar10BenchmarkTests.local_flags)
 def setUpClass(cls):  # pylint: disable=invalid-name
     super(BaseTest, cls).setUpClass()
     cifar10_main.define_cifar_flags()
Exemple #4
0
        num_eval_steps = None
        validation_data = None

    history = model.fit(
        train_input_dataset,
        epochs=train_epochs,
        steps_per_epoch=train_steps,
        callbacks=[time_callback, lr_callback, tensorboard_callback],
        validation_steps=num_eval_steps,
        validation_data=validation_data,
        verbose=2)
    eval_output = None
    if not flags_obj.skip_eval:
        eval_output = model.evaluate(eval_input_dataset,
                                     steps=num_eval_steps,
                                     verbose=1)
    stats = keras_common.build_stats(history, eval_output, time_callback)
    return stats


def main(_):
    with logger.benchmark_context(flags.FLAGS):
        return run(flags.FLAGS)


if __name__ == '__main__':
    tf.logging.set_verbosity(tf.logging.INFO)
    cifar_main.define_cifar_flags()
    keras_common.define_keras_flags()
    absl_app.run(main)
Exemple #5
0
 def setUpClass(cls):  # pylint: disable=invalid-name
   super(KerasCifarTest, cls).setUpClass()
   cifar10_main.define_cifar_flags()
   keras_common.define_keras_flags()
  history = model.fit(train_input_dataset,
                      epochs=train_epochs,
                      steps_per_epoch=train_steps,
                      callbacks=[
                          time_callback,
                          lr_callback,
                          tensorboard_callback
                      ],
                      validation_steps=num_eval_steps,
                      validation_data=validation_data,
                      verbose=1)
  eval_output = None
  if not flags_obj.skip_eval:
    eval_output = model.evaluate(eval_input_dataset,
                                 steps=num_eval_steps,
                                 verbose=1)
  stats = keras_common.build_stats(history, eval_output, time_callback)
  return stats


def main(_):
  with logger.benchmark_context(flags.FLAGS):
    return run(flags.FLAGS)


if __name__ == '__main__':
  tf.logging.set_verbosity(tf.logging.INFO)
  cifar_main.define_cifar_flags()
  keras_common.define_keras_flags()
  absl_app.run(main)
Exemple #7
0
 def setUpClass(cls):  # pylint: disable=invalid-name
     super(KerasCifarTest, cls).setUpClass()
     cifar10_main.define_cifar_flags()
     keras_common.define_keras_flags()
Exemple #8
0
 def setUpClass(cls):  # pylint: disable=invalid-name
   super(BaseTest, cls).setUpClass()
   cifar10_main.define_cifar_flags()
Exemple #9
0
 def setUpClass(cls):  # pylint: disable=invalid-name
   super(BaseTest, cls).setUpClass()
   if keras_utils.is_v2_0:
     tf.compat.v1.disable_eager_execution()
   cifar10_main.define_cifar_flags()