If `feed_order` is not passed in, then the default older will not be consistent.
Created by: daming-lu
We found a bug while testing the new API. If we pass in trainer.train()
a feed order of a list like below:
trainer.train(
reader=train_reader,
num_epochs=100,
event_handler=event_handler,
feed_order=['x', 'y'])
Then later call the trainer.test()
without a feed_order
. Then the pre-defined order (in this case, ['x', 'y']) will not be respected. In trainer.test()
, it would become ['y', 'x'].
The cause is here:
paddle/fluid/trainer.py(279)build_feed_var_list()
if feed_order is None:
feed_var_list = [
var for var in program.global_block().vars.itervalues()
if var.is_data
]
Inside program.global_block().vars.itervalues()
, we converted the passed-in list
into a dictionary thus the order is not obeyed.
![screen shot 2018-05-10 at 9 53 58 pm](https://user-images.githubusercontent.com/5635322/39907297-ad1913a0-549c-11e8-906f-007779493ddd.png)