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

如何将paddle模型中的sub_block导出成onnx #1217

Open
woodenwatcher opened this issue Apr 2, 2024 · 0 comments
Open

如何将paddle模型中的sub_block导出成onnx #1217

woodenwatcher opened this issue Apr 2, 2024 · 0 comments

Comments

@woodenwatcher
Copy link

woodenwatcher commented Apr 2, 2024

想将paddle模型中conditional_block算子的“sub_block”属性里的子图导出成onnx,代码如下,其中第10行和11行之间应该将sub_block转为program类型的对象后再传递给run_convert,但我不知道如何去转换


1. import paddle
2. import paddle2onnx
3.  
4. paddle.enable_static()
5. 
6. program = paddle.load("inference.pdmodel")
7. for block in porgram.blocks:
8.     if op.type == "conditional_block":
9.         sub_bock_id = op.attr("sub_block").id
10.        sub_block = block.program.block(sub_block_id)
11.        onnx_model = paddle2onnx.run_convert(sub_block)

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

1 participant