From 6f970c1baa4484307e002cc8d2e4ba95dfe4e5f9 Mon Sep 17 00:00:00 2001 From: wangyang59 Date: Wed, 14 Dec 2016 17:59:07 -0800 Subject: [PATCH] after clang-format --- demo/mnist/mnist_provider.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/demo/mnist/mnist_provider.py b/demo/mnist/mnist_provider.py index c435e1681d..4635833d36 100644 --- a/demo/mnist/mnist_provider.py +++ b/demo/mnist/mnist_provider.py @@ -1,6 +1,7 @@ from paddle.trainer.PyDataProvider2 import * import numpy + # Define a py data provider @provider( input_types={'pixel': dense_vector(28 * 28), @@ -20,13 +21,14 @@ def process(settings, filename): # settings is not used currently. n = 60000 else: n = 10000 - - images = numpy.fromfile(f, 'ubyte', count=n*28*28).reshape((n, 28*28)).astype('float32') - images = images / 255.0 * 2.0 - 1.0 + + images = numpy.fromfile( + f, 'ubyte', count=n * 28 * 28).reshape((n, 28 * 28)).astype('float32') + images = images / 255.0 * 2.0 - 1.0 labels = numpy.fromfile(l, 'ubyte', count=n).astype("int") - + for i in xrange(n): yield {"pixel": images[i, :], 'label': labels[i]} - + f.close() l.close() -- GitLab