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

在使用导出的onnx模型推理是报错:0th dimension != 279 #1432

Open
yeyupiaoling opened this issue Nov 17, 2024 · 3 comments
Open
Assignees
Labels
Bug Something isn't working Operator(Update)

Comments

@yeyupiaoling
Copy link

环境

  • PaddlePaddle 2.6.1
  • Ubuntu 22.04
  • Paddle2ONNX 1.2.11
  • onnxruntime 1.19.2

问题描述

在使用onnxrunime推理的是报错,错误信息如下:

    return self._sess.run(output_names, input_feed, run_options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Non-zero status 
code returned while running BatchNormalization node. Name:'BatchNormalization.2' Status Message: Invalid input scale: 0th dimension != 279

更多信息 :

导出模型的命令:

paddle2onnx --model_dir models/inference/ \
            --model_filename model.pdmodel \
            --params_filename model.pdiparams \
            --save_file models/inference/model.onnx \
            --opset_version 16

使用PaddleInference推理正常。

使用到的BatchNorm有三个:

self.bn = nn.BatchNorm2D(num_channels_out, data_format='NCHW')
······
self.bn = nn.BatchNorm1D(rnn_layer_size * 2, data_format='NLC')
······
self.bn = nn.BatchNorm1D(hidden_size, data_format='NLC')
@Zheng-Bicheng
Copy link
Collaborator

模型方便放出来一下嘛?

@Zheng-Bicheng
Copy link
Collaborator

PaddleInference 模型

@Zheng-Bicheng Zheng-Bicheng self-assigned this Nov 22, 2024
@Zheng-Bicheng Zheng-Bicheng added Bug Something isn't working Operator(Update) labels Nov 22, 2024
@yeyupiaoling
Copy link
Author

@Zheng-Bicheng 可以的可以的,网盘里包含了PaddleInference 模型和导出的ONNX模型

模型地址:百度网盘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Operator(Update)
Projects
None yet
Development

No branches or pull requests

2 participants