RuntimeError: stride should contain 2 elements for 2D convolution

Hi
im trying to quantize efficinetdet model but i faced with this error:

400         if self.padding_mode == 'zeros':
401             self._packed_params = torch.ops.quantized.conv2d_prepack(

→ 402 w, b, self.stride, self.padding, self.dilation, self.groups)
403 else:
404 self._packed_params = torch.ops.quantized.conv2d_prepack(

RuntimeError: stride should contain 2 elements for 2D convolution.

git repo:

Haven’t found much for conv2d_prepack, but have you tried passing a tuple as stride?

self._packed_params = torch.ops.quantized.conv2d_prepack(w, b, (self.stride, self.stride), self.padding, self.dilation, self.groups)

If that is the issue, you might need to pass padding as a tuple as well.

1 Like