executorch icon indicating copy to clipboard operation
executorch copied to clipboard

Support for transposed Conv ? ( ETA / Help with custom implementation )

Open mylifeasazucchini opened this issue 2 years ago • 4 comments

Hi folks!

I have been trying to follow along with this guide listed here to create a bare metal test app that passes a constant tensor through the model to test the model loading. I lowered my model for xnnpack backend and hence made the appropriate changes in the CMakeLists.txt and in the model lowering process and successfully built the test app. But when I ran:

./cmake-out/backends/xnnpack/xnn_executor_runner --model_path ../MySmallModel_xnnpack.pte

I received the error stating that transposed-conv is not supported yet in the output,

Removing the transposed_Conv layer fixes the error for me but it is sorta pivotal for my task at hand, so the question is do you guys have this op in some pipeline for future support that would be available anytime soon ?

You could try reproducing the issue with this mini example model here (let me know if you need the whole export code or something else!)

class MySmallModel(torch.nn.Module):
    def __init__(self):
        super().__init__() 
        self.convl = nn.Conv2d(2, 32, 3,stride=1, padding=1)
        self.bn1 = nn.BatchNorm2d(32)
        self.relu = nn.ReLU()
        self.t_convl = nn.ConvTranspose2d(32, 32, kernel_size=2, stride=2)

    def forward(self, x):
        x = self.convl(cat([x, x], dim=1))  # x = torch.Size([1, 32, 256, 256]
        x = self.bn1(x)
        x = self.relu(x)
        x = self.t_convl(x)
        return x

mylifeasazucchini avatar Dec 12 '23 12:12 mylifeasazucchini

Hi @mylifeasazucchini, so we are still working on operator coverage and transposed convolution is one of the ops we are planning to implement but unfortunately haven't gotten around to it yet.

@mcr229 or @digantdesai; do you guys know if transposed convolution is supported in XNNPACK? It would be preferable to run this operator through XNNPACK delegate as opposed to via portable operator since it will be a pretty performance intensive op.

SS-JIA avatar Dec 12 '23 15:12 SS-JIA

Yes XNNPACK supports it, we haven't wired it up to ExecuTorch yet.

Both XNNPACK and Portable variants will be added in the long run, but as Stephen said we are deciding which one should go first right now.

digantdesai avatar Dec 13 '23 18:12 digantdesai

@digantdesai @mcr229 - do we have tranposed conv in XNNPACK?

@SS-JIA @manuelcandales - do we have transposed conv in portable ops?

mergennachin avatar May 13 '24 17:05 mergennachin

no, we don't have it in portable yet

manuelcandales avatar May 16 '24 18:05 manuelcandales

landed transposed convolution in #4197

manuelcandales avatar Jul 11 '24 03:07 manuelcandales