ONNX: export failure: Exporting the operator silu to ONNX opset version 12 is not suppo

时间:2025-05-07 12:34:38

项目场景:

提示:eror>>> ONNX: export failure: Exporting the operator silu to ONNX opset version 12 is not supported. Please open a bug to request ONNX export support for the missing operator.


问题描述

onnx不支持silu:


解决方案:

找到python路径/Lib/site-packages/torch/nn/modules/:

 重写394def forward(self, input: Tensor) -> Tensor:
        # 原始
        # return (input, inplace=)
        # 重写
        return input * torch.sigmoid(input)