I swapped out Conv2d for F.conv2d in

and Conv2d works better since it’s optimized but conv2d seems to take a really long time to converge, did I miss something in the code?

```
class CNN(nn.Module):
def __init__(self, vocab_size, embedding_dim, n_filters, filter_sizes, output_dim,
dropout, pad_idx):
super().__init__()
self.embedding = nn.Embedding(vocab_size, embedding_dim, padding_idx = pad_idx)
self.conv_0 = nn.Parameter(torch.randn((1,
n_filters,
filter_sizes[0], embedding_dim)))
self.conv_1 = nn.Parameter(torch.randn((1,
n_filters,
filter_sizes[1], embedding_dim)))
self.conv_2 = nn.Parameter(torch.randn((1,
n_filters,
filter_sizes[2], embedding_dim)))
self.fc = nn.Linear(len(filter_sizes) * n_filters, output_dim)
self.dropout = nn.Dropout(dropout)
def forward(self, text):
#text = [sent len, batch size]
text = text.permute(1, 0)
#text = [batch size, sent len]
embedded = self.embedding(text)
#embedded = [batch size, sent len, emb dim]
embedded = embedded.unsqueeze(1)
#embedded = [batch size, 1, sent len, emb dim]
conved_0 = F.relu(F.conv2d(embedded,self.conv_0).squeeze(3))
conved_1 = F.relu(F.conv2d(embedded,self.conv_1).squeeze(3))
conved_2 = F.relu(F.conv2d(embedded,self.conv_2).squeeze(3))
#conved_n = [batch size, n_filters, sent len - filter_sizes[n] + 1]
pooled_0 = F.max_pool1d(conved_0, conved_0.shape[2]).squeeze(2)
pooled_1 = F.max_pool1d(conved_1, conved_1.shape[2]).squeeze(2)
pooled_2 = F.max_pool1d(conved_2, conved_2.shape[2]).squeeze(2)
#pooled_n = [batch size, n_filters]
cat = self.dropout(torch.cat((pooled_0, pooled_1, pooled_2), dim = 1))
#cat = [batch size, n_filters * len(filter_sizes)]
return self.fc(cat)
```