import tensorflow as tf

        dataset.training_X, dataset.training_y, dataset.validation_X, dataset.validation_y
    if not os.path.exists(weights_dir):
      os.mkdir(weights_dir)
    if not os.path.exists(weights_dir + '/best_models'):
      os.mkdir(weights_dir + '/best_models')

    # Create a saver.
    saver = tf.train.Saver(max_to_keep=None)
    if self.is_summary:
      training_batch_summary_op = tf.merge_all_summaries(key=TRAINING_BATCH_SUMMARIES)
      training_epoch_summary_op = tf.merge_all_summaries(key=TRAINING_EPOCH_SUMMARIES)
      validation_batch_summary_op = tf.merge_all_summaries(key=VALIDATION_BATCH_SUMMARIES)
      validation_epoch_summary_op = tf.merge_all_summaries(key=VALIDATION_EPOCH_SUMMARIES)

    # Build an initialization operation to run below.
    init = tf.global_variables_initializer()

    gpu_options = tf.GPUOptions(
