Dear all,
I have a time series data, recorded by 10 sensors, in shape [32,10,500] (batch size, sensor number, time points). I would like to use the same 1d kernel to filter these 10 sensor data (just like the wavelet filter), like below:

However, the m.weight.shape gives me torch.Size([10, 1, 1, 21]), which means there are 10 different filters. How can I filter the 10 sensor data with the same filter?

Thanks in advance

Basically, I just want to implement a low-pass filter on time series data.

You could move the channel dimension to the batch dimension, apply the convolution, and reshape the output back. Alternatively, you could also set the weight of each filter to the same value, but you might need to redo this operation after updating the filter.

Thanks for your reply. Did you mean something like below:

class aaa(nn.Module):
def __init__(self):
super().__init__()
self.l1=nn.Conv2d(10,10,(1,10),padding='same',padding_mode='reflect',bias=False,groups=10)
def forward(self,x):
for i in range(self.l1.weight.shape[0]):
self.l1.weight.data[i,:,:,:]=self.l1.weight.data[0,:,:,:]
output=self.l1(input)
return output

I was expecting something more elegant. Like a switch, maybe a share_weight=True? Is there such thing?