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

config.yaml文件中save_inference_fetch_varnames参数的问题 #964

Open
disheng34 opened this issue Dec 20, 2023 · 3 comments
Open

config.yaml文件中save_inference_fetch_varnames参数的问题 #964

disheng34 opened this issue Dec 20, 2023 · 3 comments

Comments

@disheng34
Copy link

请问,我在使用wide_deep静态图训练保存模型中参数save_inference_fetch_varnames具体该如何确定

我看了inference文档中写了“fetch参数输出的是auc,具体意义为static_model.py里def net()函数中将auc使用cast转换为float32类型语句中的cast算子。”,具体到现实场景,请问,我该如何确定/找到这个参数是sigmoid_0.tmp_0?类似的,其他模型中的scale_0.tmp_0等。

use_inference: True
save_inference_feed_varnames: ["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","dense_input"]
save_inference_fetch_varnames: ["sigmoid_0.tmp_0"]

谢谢

@danleifeng
Copy link
Collaborator

danleifeng commented Dec 21, 2023

您好,你可以使用Print api 测试打印一下你想要输出变量的名字。https://www.paddlepaddle.org.cn/documentation/docs/zh/2.3/api/paddle/static/Print_cn.html

@disheng34
Copy link
Author

谢谢您,我试试

@disheng34
Copy link
Author

您好,你可以使用Print api 测试打印一下你想要输出变量的名字。https://www.paddlepaddle.org.cn/documentation/docs/zh/2.3/api/paddle/static/Print_cn.html

您好,我在paddleRec的wide_deep static_model.py 中的def net()函数进行了打印:
....
auc = paddle.cast(auc, "float32")
paddle.static.Print(auc, message="The content of input layer:")
....

输出结果:
Variable: cast_2.tmp_0

  • message: The content of input layer:
  • lod: {}
  • place: Place(cpu)
  • shape: []
  • layout: NCHW
  • dtype: float
  • data: [0.9175]

同样对其中的pred变量进行了打印
....
pred = wide_deep_model.forward(self.sparse_inputs, self.dense_input,
show_click)
paddle.static.Print(pred, message="The content of input layer:")
....

输出结果:
Variable: sigmoid_0.tmp_0

  • message: The content of input layer:
  • lod: {}
  • place: Place(cpu)
  • shape: [50, 1]
  • layout: NCHW
  • dtype: float
  • data: [0.403132 0.557691 0.344832 0.356842 0.362411 0.350903 0.378425 0.491143 0.400805 0.40154 0.357373 0.514833 0.369886 0.312041 0.317104 0.345421 0.385894 0.33624 0.346485 0.482672]

这是否和serving.md文档中写的有矛盾。“fetch参数输出的是auc,具体意义为static_model.py里def net()函数中将auc使用cast转换为float32类型语句中的cast算子。” 但我实际通过打印,cast算子输出的是Variable: cast_2.tmp_0,pred这里是Variable: sigmoid_0.tmp_0

谢谢!

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

No branches or pull requests

2 participants