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

Add API: Switch global program #5260

Closed

Conversation

reyoung
Copy link
Collaborator

@reyoung reyoung commented Oct 31, 2017

No description provided.

@@ -71,6 +56,7 @@
fetch_list=[avg_cost])
out = np.array(outs[0])

print out
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove print?

g_program_dict = dict()


def switch_g_program(prog, init_prog):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this API supposed to exposed to PaddlePaddle users? It might be dangerous to expose the fact that we are having two programs -- the main one and the initializer -- to the user at this moment.

I think it is reasonable to have the main program and the initializer program -- the former is like the main function in C/C++, and the latter the C/C++ runtime entry point that initializes the global variables. It is just that we might expose only the main program to the users.

g_program_dict['init_program'] = init_prog


def g_program():
Copy link
Collaborator

Choose a reason for hiding this comment

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

g_program => main_program

It seems that the C/C++ code that initializes the global variables is known as "startup code", and the main function is known as the main program. https://gcc.gnu.org/ml/gcc-help/2007-07/msg00097.html

return g_program_dict['program']


def g_init_program():
Copy link
Collaborator

Choose a reason for hiding this comment

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

g_init_program => startup_program

It seems that the C/C++ code that initializes the global variables is known as "startup code", and the main function is known as the main program. https://gcc.gnu.org/ml/gcc-help/2007-07/msg00097.html

@reyoung
Copy link
Collaborator Author

reyoung commented Nov 27, 2017

Closed since code change too much, use #5932 instead.

@reyoung reyoung closed this Nov 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants