Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user need to set feed order for Trainer.train and Trainer.test #10679

Merged
merged 1 commit into from
May 16, 2018

Conversation

jacquesqiao
Copy link
Member

@jacquesqiao jacquesqiao commented May 16, 2018

Two reasons:

  1. I found that the order of
    var for var in program.global_block().vars.itervalues()

is unstable, it will turn out in different order on different machine.

  1. the order may change if user change it's train program, for example
    def linear():
    y = fluid.layers.data(name='y', shape=[1], dtype='float32')
    y_predict = inference_program()
    loss = fluid.layers.square_error_cost(input=y_predict, label=y)
    avg_loss = fluid.layers.mean(loss)
    return avg_loss

if user write the code as:

def linear():
    y_predict = inference_program()
    y = fluid.layers.data(name='y', shape=[1], dtype='float32')
   
    loss = fluid.layers.square_error_cost(input=y_predict, label=y)
    avg_loss = fluid.layers.mean(loss)

    return avg_loss

the order of data layer will change.

@daming-lu
Copy link
Contributor

daming-lu commented May 16, 2018

Related issues are:
#10426
#10588

Copy link

@tonyyang-svail tonyyang-svail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Contributor

@daming-lu daming-lu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note this change could cause failure on certain tests as those tests might use default feed_order. Will fix those tests correspondingly.

@daming-lu daming-lu merged commit 1c4bb5c into PaddlePaddle:develop May 16, 2018
@jacquesqiao jacquesqiao moved this from In Progress to Done in Fluid API Simplification May 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants