Convolutional NN for text input in PyTorch : <p>I am trying to implement a <a href="http://d3kbpzbmcynnmx.cloudfront.net/wp-content/uploads/2015/11/Screen-Shot-2015-11-06-at-12.05.40-PM.png" rel="noreferrer">text classification model</a> using CNN. As far as I know, for text data, we should use 1d Convolution. I saw an example in pytorch using Conv2d but I want to know how can I apply Conv1d for text? Or, it is actually not possible?</p>

<p>Here is my model scenario:</p>

<pre><code>Number of in-channels: 1, Number of out-channels: 128 
Kernel size : 3 (only want to consider trigrams)
Batch size : 16
</code></pre>

<p>So, I will provide tensors of shape, &lt;16, 1, 28, 300> where 28 is the length of a sentence. I want to use Conv1d which will give me 128 feature maps of length 26 (as I am considering trigrams).</p>

<p>I am not sure, how to define nn.Conv1d() for this setting. I can use Conv2d but want to know is it possible to achieve the same using Conv1d?</p>
