Skip to content

Commit 828303b

Browse files
author
wangyang59
committed
after clang-format
1 parent ff4e046 commit 828303b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

demo/mnist/mnist_provider.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from paddle.trainer.PyDataProvider2 import *
22
import numpy
33

4+
45
# Define a py data provider
56
@provider(
67
input_types={'pixel': dense_vector(28 * 28),
@@ -20,13 +21,14 @@ def process(settings, filename): # settings is not used currently.
2021
n = 60000
2122
else:
2223
n = 10000
23-
24-
images = numpy.fromfile(f, 'ubyte', count=n*28*28).reshape((n, 28*28)).astype('float32')
25-
images = images / 255.0 * 2.0 - 1.0
24+
25+
images = numpy.fromfile(
26+
f, 'ubyte', count=n * 28 * 28).reshape((n, 28 * 28)).astype('float32')
27+
images = images / 255.0 * 2.0 - 1.0
2628
labels = numpy.fromfile(l, 'ubyte', count=n).astype("int")
27-
29+
2830
for i in xrange(n):
2931
yield {"pixel": images[i, :], 'label': labels[i]}
30-
32+
3133
f.close()
3234
l.close()

0 commit comments

Comments
 (0)