From 1c4bb5c83d872ab878e21e27c627f718c6f779cd Mon Sep 17 00:00:00 2001 From: Qiao Longfei Date: Wed, 16 May 2018 11:15:45 +0800 Subject: [PATCH] user need to set feed order for Trainer.train and Trainer.test (#10679) --- python/paddle/fluid/trainer.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/python/paddle/fluid/trainer.py b/python/paddle/fluid/trainer.py index 2f1e70724fb..c24662ac211 100644 --- a/python/paddle/fluid/trainer.py +++ b/python/paddle/fluid/trainer.py @@ -172,9 +172,9 @@ class Trainer(object): def train(self, num_epochs, event_handler, - reader=None, - parallel=False, - feed_order=None): + reader, + feed_order, + parallel=False): """ Train the model. @@ -202,7 +202,7 @@ class Trainer(object): self._train_by_executor(num_epochs, event_handler, reader, feed_order) - def test(self, reader, feed_order=None): + def test(self, reader, feed_order): """ Test the model on given test data @@ -276,12 +276,7 @@ def build_feed_var_list(program, feed_order): if not isinstance(program, framework.Program): raise TypeError("The 'program' should be an object of Program") - if feed_order is None: - feed_var_list = [ - var for var in program.global_block().vars.itervalues() - if var.is_data - ] - elif isinstance(feed_order, list): + if isinstance(feed_order, list): feed_var_list = [ program.global_block().var(var_name) for var_name in feed_order ] -- GitLab