Twins
Twins copied to clipboard
Problem regarding PEG
In the init function of the PEG class, it seems that the groups parameter should be set to in_chans rather than embed_dim, since this is intended to be a depthwise convolution. Although in the current use cases in the file, in_chans and embed_dim are equal, updating this would make the code clearer and more explicit.
# PEG from https://arxiv.org/abs/2102.10882
class PosCNN(nn.Module):
def __init__(self, in_chans, embed_dim=768, s=1):
super(PosCNN, self).__init__()
self.proj = nn.Sequential(nn.Conv2d(in_chans, embed_dim, 3, s, 1, bias=True, groups=embed_dim), )
self.s = s