admin管理员组

文章数量:1618706

项目场景:

提示: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/activation.py:

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

本文标签: Exportingoperatorfailureonnxexport