diff --git a/demo/mnist/api_train_v2.py b/demo/mnist/api_train_v2.py index 19e273ebfd96d798d3495a9f44329adb38f8d503..a59b30ccdb2eddea6680d6ad5c790c857b9c5141 100644 --- a/demo/mnist/api_train_v2.py +++ b/demo/mnist/api_train_v2.py @@ -20,7 +20,7 @@ def main(): adam_optimizer = paddle.optimizer.Adam(learning_rate=0.01) - trainer = paddle.trainer.SGD(topology=cost, + trainer = paddle.trainer.SGD(cost=cost, parameters=parameters, update_equation=adam_optimizer) @@ -28,7 +28,7 @@ def main(): if isinstance(event, paddle.event.EndIteration): if event.batch_id % 1000 == 0: result = trainer.test(reader=paddle.reader.batched( - paddle.dataset.mnist.test_creator(), batch_size=256)) + paddle.dataset.mnist.test(), batch_size=256)) print "Pass %d, Batch %d, Cost %f, %s, Testing metrics %s" % ( event.pass_id, event.batch_id, event.cost, event.metrics, diff --git a/python/paddle/v2/dataset/mnist.py b/python/paddle/v2/dataset/mnist.py index f1315b35cd55c5387295f1f883b997cd6dd71bd1..1512a3c3189de4e54f8502cfadf450b0710a246e 100644 --- a/python/paddle/v2/dataset/mnist.py +++ b/python/paddle/v2/dataset/mnist.py @@ -9,9 +9,9 @@ __all__ = ['train', 'test'] URL_PREFIX = 'http://yann.lecun.com/exdb/mnist/' TEST_IMAGE_URL = URL_PREFIX + 't10k-images-idx3-ubyte.gz' -TEST_IMAGE_MD5 = '25e3cc63507ef6e98d5dc541e8672bb6' +TEST_IMAGE_MD5 = '9fb629c4189551a2d022fa330f9573f3' TEST_LABEL_URL = URL_PREFIX + 't10k-labels-idx1-ubyte.gz' -TEST_LABEL_MD5 = '4e9511fe019b2189026bd0421ba7b688' +TEST_LABEL_MD5 = 'ec29112dd5afa0611ce80d1b7f02629c' TRAIN_IMAGE_URL = URL_PREFIX + 'train-images-idx3-ubyte.gz' TRAIN_IMAGE_MD5 = 'f68b3c2dcbeaaa9fbdd348bbdeb94873' TRAIN_LABEL_URL = URL_PREFIX + 'train-labels-idx1-ubyte.gz' diff --git a/python/paddle/v2/trainer.py b/python/paddle/v2/trainer.py index b7d69ddb5d90716b008cb50ab54ece216fc7123f..5003f55f3e0d15149d28d1478e0487d6873d6e0a 100644 --- a/python/paddle/v2/trainer.py +++ b/python/paddle/v2/trainer.py @@ -61,7 +61,7 @@ class SGD(ITrainer): self.__topology__ = topology self.__parameters__ = parameters self.__topology_in_proto__ = topology.proto() - self.__data_types__ = topology.data_layers() + self.__data_types__ = topology.data_type() gm = api.GradientMachine.createFromConfigProto( self.__topology_in_proto__, api.CREATE_MODE_NORMAL, self.__optimizer__.enable_types())