Hi,
I am trying to convert a pytorch model to Onnx format. I am using F.unfold in between.
But while converting I am getting below error.
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
import torch
class Test_model(torch.nn.Module):
def forward(self, x, y):
x = torch.rand(1, 64, 157, 317)
#x=F.unfold(x, kernel_size=3, padding=1)
unfold_p0=nn.Unfold(kernel_size=3,padding=0, stride=4)
x=unfold_p0(x)
return x
model = Test_model()
dummy_input = torch.ones(2, 3, dtype=torch.long)
loop_count = torch.tensor(5, dtype=torch.long)
torch.onnx.export(model, (dummy_input, loop_count), ‘loop.onnx’, verbose=True)
proto, export_map = graph._export_onnx(params, _onnx_opset_version, defer_weight_export, operator_export_type)
RuntimeError: ONNX export failed: Couldn’t export Python operator Im2Col
I am using torch version: 1.2.0