Pytorch使用集成可形变卷积构建网络并导出onnx模型
解决RuntimeError: Exporting the operator deform_conv2d to ONNX opset version 14 is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub问题
参考
一、安装对应的包
pip install deform_conv2d_onnx_exporter
二、构建简易网络模型
import torch
import torchvision.ops
from torch import nn
import deform_conv2d_onnx_exporter
deform_conv2d_onnx_exporter.register_deform_conv2d_onnx_op()class mynet(nn.Module):def __init__(self):super(mynet,self).__init__()self.weight = torch.rand(5, 3, 3, 3) # (out_channels, in_c