专栏算法工具链模型量化时reshape推断失败,导致量化退化到batch=1,速度太慢

模型量化时reshape推断失败,导致量化退化到batch=1,速度太慢

阿白-西2026-04-17
11
3

平台信息:J6M,OE版本:3.7.1

错误描述:

模型中的一个reshape节点无法转为多batch,1x1x18x10 -> 1x1x1x180;报错为The input tensor cannot be reshaped to the requested shape. Input shape:{8,1,10,18}, requested shape:{1,1,1,180}

报错信息:

26-04-17 20:17:36.609067620 [E:onnxruntime:, sequential_executor.cc:516 ExecuteKernel] Non-zero status code returned while running Reshape node. Name:'Sigmoid_1505_onnx::Concat_2881_transpose_Reshape' Status Message: /onnxruntime_src/onnxruntime/core/providers/cpu/tensor/reshape_helper.h:45 onnxruntime::ReshapeHelper::ReshapeHelper(const onnxruntime::TensorShape&, onnxruntime::TensorShapeVector&, bool) input_shape_size == size was false. The input tensor cannot be reshaped to the requested shape. Input shape:{8,1,10,18}, requested shape:{1,1,1,180}

模型截图:

错误信息:

算法工具链
技术深度解析征程6
评论1
0/1000
  • YCJ
    Lv.4

    这个是工具链在校准的时候尝试8 batch校准失败报的错,对后续的量化过程没有影响。工具链在校准的时候首先会尝试8 batch校准,如果你的onnx模型不支持8 batch推理会退回到单batch校准。

    12小时前
    0
    2
    • 阿白-西回复YCJ:

      input_batch设置为8是可以转出模型的,只是在量化过程中会退化到单batch,有没有通用的方法能解决量化时不支持8 batch的问题,这个reshape没有升/降维的操作

      6小时前
      0
    • YCJ回复阿白-西:
      5小时前
      0