Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions tutorials/image/cifar10/cifar10.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
from __future__ import division
from __future__ import print_function

import argparse
import os
import re
import sys
Expand All @@ -46,19 +45,15 @@

import cifar10_input

parser = argparse.ArgumentParser()
FLAGS = tf.app.flags.FLAGS

# Basic model parameters.
parser.add_argument('--batch_size', type=int, default=128,
help='Number of images to process in a batch.')

parser.add_argument('--data_dir', type=str, default='/tmp/cifar10_data',
help='Path to the CIFAR-10 data directory.')

parser.add_argument('--use_fp16', type=bool, default=False,
help='Train the model using fp16.')

FLAGS = parser.parse_args()
tf.app.flags.DEFINE_integer('batch_size', 128,
"""Number of images to process in a batch.""")
tf.app.flags.DEFINE_string('data_dir', '/tmp/cifar10_data',
"""Path to the CIFAR-10 data directory.""")
tf.app.flags.DEFINE_boolean('use_fp16', False,
"""Train the model using fp16.""")

# Global constants describing the CIFAR-10 data set.
IMAGE_SIZE = cifar10_input.IMAGE_SIZE
Expand Down
34 changes: 14 additions & 20 deletions tutorials/image/cifar10/cifar10_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,20 @@

import cifar10

parser = cifar10.parser

parser.add_argument('--eval_dir', type=str, default='/tmp/cifar10_eval',
help='Directory where to write event logs.')

parser.add_argument('--eval_data', type=str, default='test',
help='Either `test` or `train_eval`.')

parser.add_argument('--checkpoint_dir', type=str, default='/tmp/cifar10_train',
help='Directory where to read model checkpoints.')

parser.add_argument('--eval_interval_secs', type=int, default=60*5,
help='How often to run the eval.')

parser.add_argument('--num_examples', type=int, default=10000,
help='Number of examples to run.')

parser.add_argument('--run_once', type=bool, default=False,
help='Whether to run eval only once.')
FLAGS = tf.app.flags.FLAGS

tf.app.flags.DEFINE_string('eval_dir', '/tmp/cifar10_eval',
"""Directory where to write event logs.""")
tf.app.flags.DEFINE_string('eval_data', 'test',
"""Either 'test' or 'train_eval'.""")
tf.app.flags.DEFINE_string('checkpoint_dir', '/tmp/cifar10_train',
"""Directory where to read model checkpoints.""")
tf.app.flags.DEFINE_integer('eval_interval_secs', 60 * 5,
"""How often to run the eval.""")
tf.app.flags.DEFINE_integer('num_examples', 10000,
"""Number of examples to run.""")
tf.app.flags.DEFINE_boolean('run_once', False,
"""Whether to run eval only once.""")


def eval_once(saver, summary_writer, top_k_op, summary_op):
Expand Down Expand Up @@ -159,5 +154,4 @@ def main(argv=None): # pylint: disable=unused-argument


if __name__ == '__main__':
FLAGS = parser.parse_args()
tf.app.run()
23 changes: 10 additions & 13 deletions tutorials/image/cifar10/cifar10_multi_gpu_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,17 @@
import tensorflow as tf
import cifar10

parser = cifar10.parser
FLAGS = tf.app.flags.FLAGS

parser.add_argument('--train_dir', type=str, default='/tmp/cifar10_train',
help='Directory where to write event logs and checkpoint.')

parser.add_argument('--max_steps', type=int, default=1000000,
help='Number of batches to run.')

parser.add_argument('--num_gpus', type=int, default=1,
help='How many GPUs to use.')

parser.add_argument('--log_device_placement', type=bool, default=False,
help='Whether to log device placement.')
tf.app.flags.DEFINE_string('train_dir', '/tmp/cifar10_train',
"""Directory where to write event logs """
"""and checkpoint.""")
tf.app.flags.DEFINE_integer('max_steps', 1000000,
"""Number of batches to run.""")
tf.app.flags.DEFINE_integer('num_gpus', 1,
"""How many GPUs to use.""")
tf.app.flags.DEFINE_boolean('log_device_placement', False,
"""Whether to log device placement.""")


def tower_loss(scope, images, labels):
Expand Down Expand Up @@ -276,5 +274,4 @@ def main(argv=None): # pylint: disable=unused-argument


if __name__ == '__main__':
FLAGS = parser.parse_args()
tf.app.run()
23 changes: 10 additions & 13 deletions tutorials/image/cifar10/cifar10_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,17 @@

import cifar10

parser = cifar10.parser
FLAGS = tf.app.flags.FLAGS

parser.add_argument('--train_dir', type=str, default='/tmp/cifar10_train',
help='Directory where to write event logs and checkpoint.')

parser.add_argument('--max_steps', type=int, default=1000000,
help='Number of batches to run.')

parser.add_argument('--log_device_placement', type=bool, default=False,
help='Whether to log device placement.')

parser.add_argument('--log_frequency', type=int, default=10,
help='How often to log results to the console.')
tf.app.flags.DEFINE_string('train_dir', '/tmp/cifar10_train',
"""Directory where to write event logs """
"""and checkpoint.""")
tf.app.flags.DEFINE_integer('max_steps', 1000000,
"""Number of batches to run.""")
tf.app.flags.DEFINE_boolean('log_device_placement', False,
"""Whether to log device placement.""")
tf.app.flags.DEFINE_integer('log_frequency', 10,
"""How often to log results to the console.""")


def train():
Expand Down Expand Up @@ -126,5 +124,4 @@ def main(argv=None): # pylint: disable=unused-argument


if __name__ == '__main__':
FLAGS = parser.parse_args()
tf.app.run()