Navigation Menu

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.mean导出ONNX的问题 #221

Open
BBuf opened this issue Mar 26, 2021 · 0 comments
Open

paddle.mean导出ONNX的问题 #221

BBuf opened this issue Mar 26, 2021 · 0 comments
Assignees

Comments

@BBuf
Copy link

BBuf commented Mar 26, 2021

你好,当我执行下面的代码导出onnx模型时:

import paddle.nn as nn
import paddle
import onnx

class Net(nn.Layer):
        def forward(self, x):
            return paddle.mean(x)

input_size = (2, 4, 3, 5)
paddle_model = Net()
paddle.set_device("cpu")
input_names = "x_0"
paddle_model.eval()
input_spec = paddle.static.InputSpec(
    shape=input_size , dtype="float32", name=input_names
)
mode_str = "em"

paddle.onnx.export(
    paddle_model,
    mode_str,
    input_spec=[input_spec],
    opset_version=12,
    enable_onnx_checker=True,
)

导出来的ONNX模型是这样:

图片

由于我并没有指定paddle mean op的 axis参数,所以期望导出的onnx模型的axes attribute参数是None,不然ONNX获得的结果是错误的,并且也无法区分paddle.mean(x, axis=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