'aten::slow_conv_transpose2d' not support in 'QuantizedCPUTensorID'

OS: Win7 64bit
Pytorch 1.5.0_CPU
when I try to quantize an unet model, meet the error below:

RuntimeError: Could not run 'aten::slow_conv_transpose2d' with arguments from the 'QuantizedCPUTensorId' backend. 'aten::slow_conv_transpose2d' is only available for these backends: [CPUTensorId, VariableTensorId].

Is there any way to workaround this?

1 Like

Had the exact same problem. I worked around this by inserting torch.quantization.DeQuantStub and torch.quantization.QuantStub before and after the ConvTranspose2d layer. I don’t know if this affects performance or anything.

Just take a look at the following class I converted:

from torch.quantization import DeQuantStub, QuantStub
class UpsamplerBlock (nn.Module):
    def __init__(self, ninput, noutput):
        super(UpsamplerBlock, self).__init__()
        self.conv = nn.ConvTranspose2d(ninput, noutput, 3, stride=2, padding=1, output_padding=1, bias=True)
        self.bn = nn.BatchNorm2d(noutput, eps=1e-3)
        self.quant = QuantStub()
        self.dequant = DeQuantStub()

    def forward(self, input):
        output = self.conv(self.dequant(input))
        output = self.bn(self.quant(output))
        return F.relu(output)
1 Like

yeah, quantized conv transpose 2d is not supported yet, but @Zafar is working on it right now

1 Like