What is the right way of implementing a convolutional layer that has shared weights for each input stream?
I have made an implementation where use convolutional layers with a single layer and then loop through each channel of the input stream to apply that convolution.
z = self.conv0(x[:,0,:].view(x.shape, 1, x.shape)) for i in range(1, x.shape): z = torch.cat([z,self.conv0(x[:,i,:].view(x.shape, 1, x.shape))], dim = 1)
Another idea that I have was shuffling weights of a convolutional layer but that wouldn’t save from the number of parameters used, although I would expect them to get similar to each other over training.
temp = model.conv1.conv.weight temp = temp[:,torch.randperm(temp.shape),:] model.conv1.conv.weight = nn.Parameter(temp)
Finally, I thought the group parameter, which is used for depth-wise separable convolutions, can be used for that purpose, but that’s not the case in the documentation.
I am looking forward for your suggestions. Thank you in advance.