Skip to content

Feature/switch program#5932

Merged
reyoung merged 13 commits intoPaddlePaddle:developfrom
reyoung:feature/switch_program
Nov 30, 2017
Merged

Feature/switch program#5932
reyoung merged 13 commits intoPaddlePaddle:developfrom
reyoung:feature/switch_program

Conversation

@reyoung
Copy link
Collaborator

@reyoung reyoung commented Nov 27, 2017

Second step of #5929.
Fix #5929.

Please review #5930 first.

Change books just use `import fluid`, not submodules
Use default_main_program/default_startup_program instead
* Two functions: switch_main_program/switch_startup_program
* A guard: program_guard. Users can use the `with` statement change
  default programs
* Change unittests in `test_layers`
@reyoung reyoung added this to the Release 0.11.0 milestone Nov 27, 2017
@reyoung reyoung requested a review from QiJune November 29, 2017 09:24
global _main_program_
prev_program = _main_program_
_main_program_ = program
return prev_program
Copy link
Member

Choose a reason for hiding this comment

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

Here, why return prev_program, not _main_program_? We are switch to a new program, not previous one

Get default main program. The main program is used for training or testing.

Returns:
Program: main program
Copy link
Member

Choose a reason for hiding this comment

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

Why we need this default_main_program() function, not use _main_program_ directly?

Copy link
Member

@QiJune QiJune left a comment

Choose a reason for hiding this comment

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

LGTM

@reyoung reyoung merged commit ac596a3 into PaddlePaddle:develop Nov 30, 2017
@reyoung reyoung deleted the feature/switch_program branch December 26, 2017 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants