Add API: Switch global program#5260
Conversation
| fetch_list=[avg_cost]) | ||
| out = np.array(outs[0]) | ||
|
|
||
| print out |
| g_program_dict = dict() | ||
|
|
||
|
|
||
| def switch_g_program(prog, init_prog): |
There was a problem hiding this comment.
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(): |
There was a problem hiding this comment.
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(): |
There was a problem hiding this comment.
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
|
Closed since code change too much, use #5932 instead. |
No description provided.