I figured it out !!!
it’s the padding. I realized what i actually wanted was half the filter length from each direction. it now runs fine ( even for a larger network ).
class Net(nn.Module):
def __init__(self, in_channels, out_channels, filter_len):
super(Net, self).__init__()
self.conv_lin = nn.Conv1d(in_channels, out_channels, filter_len, padding=(filter_len - 1)//2)
nn.init.xavier_uniform(self.conv_lin.weight)
self.conv_sig = nn.Conv1d(in_channels, out_channels, filter_len, padding=(filter_len - 1)//2)
nn.init.xavier_uniform(self.conv_sig.weight)
def forward(self, x):
x_lin = self.conv_lin(x)
x_sig = torch.sigmoid(self.conv_sig(x))
return x_lin * x_sig
I guess there is some bug involving unexpectedly long padding…