title: expected Double tensor (got Float tensor) in Pytorch
body: <p>I want to create <code>nn.Module</code> in <a href="http://pytorch.org" rel="nofollow noreferrer">Pytorch</a>. I used following code for text related problem (In fact I use <code>Glove</code> 300d pre-trained embedding and weighted average of words in a sentence to do classification).</p>
  
  <pre><code>class Net(nn.Module):
      def __init__(self):
          super(Net, self).__init__()
          self.conv1 = nn.Conv1d(300, 128, kernel_size=5)
          self.conv2 = nn.Conv1d(128, 64, kernel_size=2)
          self.conv2_drop = nn.Dropout()
          self.fc1 = nn.Linear(64, 20)
          self.fc2 = nn.Linear(20, 2)
  
      def forward(self, x):
          x = F.relu(F.avg_pool1d(self.conv1(x), 2))
          x = F.relu(F.avg_pool1d(self.conv2_drop(self.conv2(x)), 2))
          x = x.view(-1, 1)
          x = F.relu(self.fc1(x))
          x = F.dropout(x, training=self.training)
          return self.fc2(x)
  </code></pre>
  
  <p>But it gives me following error:</p>
  
  <pre><code>Traceback (most recent call last):
      x = F.relu(F.avg_pool1d(self.conv1(x), 2))
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/torch/nn/modules/module.py", line 224, in __call__
      result = self.forward(*input, **kwargs)
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/torch/nn/modules/conv.py", line 154, in forward
      self.padding, self.dilation, self.groups)
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/torch/nn/functional.py", line 83, in conv1d
      return f(input, weight, bias)
  RuntimeError: expected Double tensor (got Float tensor)
  </code></pre>
  
  <p>I fairly new to <code>Conv1d</code>, and most of tutorial used <code>Conv1d</code> for image problems. Can anybody give me some idea what's the problem?</p>
  
  <p>I also added <code>model.double()</code> inside forward method but gives me another error:</p>
  
  <pre><code>RuntimeError: Given input size: (300 x 1 x 1). Calculated output size: (128 x 1 x -3). Output size is too small
  </code></pre>