-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
在Fluid版本中,在预测的时候为什么还有克隆一个预测程序? #11022
Comments
注意这一行的注释,用 |
@kuke 都是同一个参数文件加载出来的程序,难道准确性还会不一样的?最后保存的参数文件跟之前的有会优化多少? |
@yeyupiaoling 因为两个program都在一个scope里,如果不clone的话,原始program在scope里的一些变量就直接发生了变化,会导致结果出错。更多细节可以看下 #9792 里的评论。
请问是指速度方面么?the elapsed time on ResNet (test_inference_image_classification) is from 11.2s to 9.3s, about 10% speedup on inference. |
我没使用过clone的Program,但是我使用原始program也没见出错呢。
为什么会导致预测速度的提高呢?谢谢 |
因为将batch norm的参数(weight和bias)都融合进conv的参数(weight和bias)中了,所以在预测的时候去掉了batch_norm(如果之前的conv没有bias,会增加一部分bias的计算),速度当然会快。 |
好的,了解了,谢谢 @luotao1 |
在以下的例子中,我看到在预测的时候,还克隆了一个预测程序,为什么要这做呢?
Paddle/python/paddle/fluid/tests/book/test_image_classification.py
Lines 225 to 227 in 60783a7
在此之前就有了一个预测程序,是从参数文件中加载的,如下:
Paddle/python/paddle/fluid/tests/book/test_image_classification.py
Lines 216 to 217 in 60783a7
同时也不知道它要在这里干什么,应该是比较吧:
Paddle/python/paddle/fluid/tests/book/test_image_classification.py
Lines 241 to 242 in 60783a7
在预测模型的时候,它为什么又要保存模型呢?
Paddle/python/paddle/fluid/tests/book/test_image_classification.py
Lines 246 to 248 in 60783a7
The text was updated successfully, but these errors were encountered: