Are depthwise ConvTranspose2d Layers supported?
Closed this issue · 7 comments
While creating a custom model I tried to use the "groups" argument for a ConvTranpose2d layer but it had no effect. I checked the ai8x.py code and apparently the argument is missing as shown in the following:
I just want to confirm if the groups argument is not present for a reason or if I just add it manually I shouldn't have problems when it comes to synthetizing the model.
I tried synthetizing a depthwise convtranspose2d layer and had no issues so these layers are definitely supported. The issue is that using the groups argument has no effect on the ai8x.ConvTranspose2d() class because in the section of ai8x.py shown above the groups argument is missing. If what I'm saying is correct then fixing the issue is simply adding the missing argument.
Hello,
Thanks for reporting the issue. For MAX78000, the 'group' must be 1 and for MAX78002 it should be either 1 or number of channels. For which device you are facing this issue? You can also share your code, yaml file, checkpoint and izer script and I can go over the issue. Thanks.
I'm working with a MAX78002. I'm using depth-wise transpose convolutions ( so groups==in_channels==out_channels ). As described above, the current version of ai8x.py is lacking the 'groups' argument when defining the conv2dtranspose layer so the following two layers give out the same result (Same amount of parameters even though depth-wise should have their parameter count divided by n_channels):
# Normal ConvTranspose
self.broadcast_conv = ai8x.ConvTranspose2d(
num_channels, num_channels, 3, stride=2,
groups=1, padding=1, bias=False, **kwargs)
# Depth-wise ConvTranspose
self.broadcast_conv = ai8x.ConvTranspose2d(
num_channels, num_channels, 3, stride=2,
groups=num_channels, padding=1, bias=False, **kwargs)
At first I thought that this was because depth-wise convtranspose where not supported but I managed to modify the ai8x.py code and synthesize a model that uses them with no issue.
So, you tested the model on MAX78002 as well, right? Or do you also have an issue with the synthesized model?
Yes I tested the model on the MAX78002 and there were no issues in the synthesized model. The problem is that when you define a ConvTranspose2d layer on the training environment using the ai8x.ConvTranspose2d() class, the groups argument has no effect.
Just so we are clear, from my end the problem is solved, but I had to modify the ai8x.py code to make it work.
In order to avoid someone else encountering the problem in the future what I propose is to simply modify the part of the ai8x.py code where the ConvTranspose2d class is defined as shown below so that the 'Groups' argument actually works. In the current version of the repository the argument is missing. See line 766 of aix8.py:
Thank you very much for reporting the issue. I will update the code accordingly.