From ff5986650258b8806ed1e18b23fe12abd23893b6 Mon Sep 17 00:00:00 2001 From: Jiabin Yang Date: Fri, 14 Jun 2019 16:17:02 +0800 Subject: [PATCH] test=develop, fix mnist will segment fault (#18083) --- python/paddle/dataset/mnist.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/paddle/dataset/mnist.py b/python/paddle/dataset/mnist.py index ab0c62df259..8dae48fae18 100644 --- a/python/paddle/dataset/mnist.py +++ b/python/paddle/dataset/mnist.py @@ -78,7 +78,10 @@ def reader_creator(image_filename, label_filename, buffer_size): buffer_size, rows * cols)).astype('float32') offset_img += struct.calcsize(fmt_images) - images = images / 255.0 * 2.0 - 1.0 + images = images / 255.0 + images = images * 2.0 + images = images - 1.0 + for i in range(buffer_size): yield images[i, :], int(labels[i]) -- GitLab