aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/model_pruning
diff options
context:
space:
mode:
authorGravatar Yifei Feng <yifeif@google.com>2018-01-29 10:42:32 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-01-29 10:46:04 -0800
commitfd63d4e30a01cf860baf60b990b223cd54bc895c (patch)
treefcea79b1e89bcf30ac80d087edf051c3711d06b1 /tensorflow/contrib/model_pruning
parent730071d0dca35a9e08f3bdc49661ae34d109da74 (diff)
Add C0326 bad-whitespace error to pylint sanity check.
PiperOrigin-RevId: 183689499
Diffstat (limited to 'tensorflow/contrib/model_pruning')
-rw-r--r--tensorflow/contrib/model_pruning/examples/cifar10/cifar10_input.py52
1 files changed, 30 insertions, 22 deletions
diff --git a/tensorflow/contrib/model_pruning/examples/cifar10/cifar10_input.py b/tensorflow/contrib/model_pruning/examples/cifar10/cifar10_input.py
index d07fece4bc..6a3b535eb4 100644
--- a/tensorflow/contrib/model_pruning/examples/cifar10/cifar10_input.py
+++ b/tensorflow/contrib/model_pruning/examples/cifar10/cifar10_input.py
@@ -58,6 +58,7 @@ def read_cifar10(filename_queue):
class CIFAR10Record(object):
pass
+
result = CIFAR10Record()
# Dimensions of the images in the CIFAR-10 dataset.
@@ -147,8 +148,9 @@ def distorted_inputs(data_dir, batch_size):
images: Images. 4D tensor of [batch_size, IMAGE_SIZE, IMAGE_SIZE, 3] size.
labels: Labels. 1D tensor of [batch_size] size.
"""
- filenames = [os.path.join(data_dir, 'data_batch_%d.bin' % i)
- for i in xrange(1, 6)]
+ filenames = [
+ os.path.join(data_dir, 'data_batch_%d.bin' % i) for i in xrange(1, 6)
+ ]
for f in filenames:
if not tf.gfile.Exists(f):
raise ValueError('Failed to find file: ' + f)
@@ -174,10 +176,9 @@ def distorted_inputs(data_dir, batch_size):
# Because these operations are not commutative, consider randomizing
# the order their operation.
- distorted_image = tf.image.random_brightness(distorted_image,
- max_delta=63)
- distorted_image = tf.image.random_contrast(distorted_image,
- lower=0.2, upper=1.8)
+ distorted_image = tf.image.random_brightness(distorted_image, max_delta=63)
+ distorted_image = tf.image.random_contrast(
+ distorted_image, lower=0.2, upper=1.8)
# Subtract off the mean and divide by the variance of the pixels.
float_image = tf.image.per_image_standardization(distorted_image)
@@ -188,15 +189,18 @@ def distorted_inputs(data_dir, batch_size):
# Ensure that the random shuffling has good mixing properties.
min_fraction_of_examples_in_queue = 0.4
- min_queue_examples = int(NUM_EXAMPLES_PER_EPOCH_FOR_TRAIN *
- min_fraction_of_examples_in_queue)
- print ('Filling queue with %d CIFAR images before starting to train. '
- 'This will take a few minutes.' % min_queue_examples)
+ min_queue_examples = int(
+ NUM_EXAMPLES_PER_EPOCH_FOR_TRAIN * min_fraction_of_examples_in_queue)
+ print('Filling queue with %d CIFAR images before starting to train. '
+ 'This will take a few minutes.' % min_queue_examples)
# Generate a batch of images and labels by building up a queue of examples.
- return _generate_image_and_label_batch(float_image, read_input.label,
- min_queue_examples, batch_size,
- shuffle=True)
+ return _generate_image_and_label_batch(
+ float_image,
+ read_input.label,
+ min_queue_examples,
+ batch_size,
+ shuffle=True)
def inputs(eval_data, data_dir, batch_size):
@@ -212,8 +216,9 @@ def inputs(eval_data, data_dir, batch_size):
labels: Labels. 1D tensor of [batch_size] size.
"""
if not eval_data:
- filenames = [os.path.join(data_dir, 'data_batch_%d.bin' % i)
- for i in xrange(1, 6)]
+ filenames = [
+ os.path.join(data_dir, 'data_batch_%d.bin' % i) for i in xrange(1, 6)
+ ]
num_examples_per_epoch = NUM_EXAMPLES_PER_EPOCH_FOR_TRAIN
else:
filenames = [os.path.join(data_dir, 'test_batch.bin')]
@@ -235,8 +240,8 @@ def inputs(eval_data, data_dir, batch_size):
# Image processing for evaluation.
# Crop the central [height, width] of the image.
- resized_image = tf.image.resize_image_with_crop_or_pad(reshaped_image,
- width, height)
+ resized_image = tf.image.resize_image_with_crop_or_pad(
+ reshaped_image, width, height)
# Subtract off the mean and divide by the variance of the pixels.
float_image = tf.image.per_image_standardization(resized_image)
@@ -247,10 +252,13 @@ def inputs(eval_data, data_dir, batch_size):
# Ensure that the random shuffling has good mixing properties.
min_fraction_of_examples_in_queue = 0.4
- min_queue_examples = int(num_examples_per_epoch *
- min_fraction_of_examples_in_queue)
+ min_queue_examples = int(
+ num_examples_per_epoch * min_fraction_of_examples_in_queue)
# Generate a batch of images and labels by building up a queue of examples.
- return _generate_image_and_label_batch(float_image, read_input.label,
- min_queue_examples, batch_size,
- shuffle=False)
+ return _generate_image_and_label_batch(
+ float_image,
+ read_input.label,
+ min_queue_examples,
+ batch_size,
+ shuffle=False)