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

项目场景:

提示: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)

你可能感兴趣的:(YOLOv5,onnx,python,深度学习,pytorch)