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

pnnx能正常转换模型,模型输出与onnx模型输出不一致 #5451

Closed
Oliverwang opened this issue May 8, 2024 · 4 comments
Closed

Comments

@Oliverwang
Copy link

error log | 日志或报错信息 | ログ

ncnn版本 ncnn-20240410
pnnx版本 pnnx-20240410-linux

运行python3 readout_query_pnnx.py 输出nan
image

model | 模型 | モデル

  1. original model

how to reproduce | 复现步骤 | 再現方法

  1. pnnx readout_query.pt inputshape=[[1,64,24,24],[1,1,16,65]]
    2.python3 readout_query_pnnx.py
@Oliverwang
Copy link
Author

Uploading readout_query.tar.gz…
模型见附件

@nihui
Copy link
Member

nihui commented May 9, 2024

    net = torch.jit.load('readout_query.pt')
    net.eval()

    torch.manual_seed(0)
    v_0 = torch.rand(1, 64, 24, 24, dtype=torch.float)
    v_1 = torch.rand(1, 1, 16, 65, dtype=torch.float)

    return net(v_0, v_1)

你提供的模型,这样随机输入,输出也是 nan

@Oliverwang
Copy link
Author

@nihui 验证了 torch.manual_seed(0) 的时候输出就会是nan 把随机种子改成别的就不会输出nan

@Oliverwang
Copy link
Author

Oliverwang commented May 10, 2024

readout_query.tar.gz
image
pt模型与onnx模型 同样的输入 输出基本能对上 pnnx的就对不上
pt模型与onnx模型 测试代码及模型在附件

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