-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Expose a interface to create all variables and enable the test of not creating variables every time. #9301
Conversation
@@ -169,8 +169,14 @@ void TestInference(const std::string& dirname, | |||
|
|||
// 6. Run the inference program | |||
{ | |||
const bool create_vars = false; | |||
if (!create_vars) { | |||
executor.CreateVariables(*inference_program, scope, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just some trivial issues, !create_vars
-> executor.CreateVariables(
seems a little wried.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create_vars
意思是在executor.Run
函数里面是否创建Variables
,默认值为true
,意思是每次Run
都会create和destroy所有的Variables
。如果executor.Run
时设置参数create_vars
为false
,那么用户需要提前手动CreateVaribales
,不然就会出现变量不存在的错误。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
能否增加一个单测说明create_vars
为false
时,用户如何提前手动CreateVaribales
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done。在image classification里面加了create_vars为false的单测。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* clean llama static modeling file * update readme * fix --------- Co-authored-by: wangnian01 <[email protected]>
Fix #9653
Sometimes users do not want to create and destroy variables in every run.
Here is the performance comparision for
test_inference_image_classificaion_resnet
.GPU: Tesla K40m, CUDA 8.0, CUDNN v7.