title: Converting a list of list to a tensor input for a CNN
body: <p>I am trying to code an autoencoder with a CNN and I have to use my own data. The data comes as a list of lists and I have converted it (or attempted to convert it) to a pytorch tensor.</p>
  <pre><code>tensor_x = torch.Tensor([np.array(v) for v in testPulses])
  print(tensor_x)
  my_dataset = TensorDataset(tensor_x) # create your datset
  data_loader = DataLoader(my_dataset) # create your dataloader
  
  #HERE PROCESS THE DATA
  tensor_x = torch.Tensor([np.array(v) for v in testPulses])
  print(tensor_x)
  my_dataset = TensorDataset(tensor_x) # create your datset
  data_loader = DataLoader(my_dataset) # create your dataloader
  tensor([[ 0.0009, -0.0010, -0.0003,  ...,  0.0033,  0.0079,  0.0030],
          [-0.0020,  0.0071,  0.0093,  ...,  0.0401,  0.0352,  0.0300],
          [ 0.0002, -0.0031,  0.0042,  ...,  0.0341,  0.0338,  0.0326],
          ...,
          [ 0.0060,  0.0084,  0.0047,  ...,  0.0380,  0.0365,  0.0334],
          [-0.0047,  0.0017, -0.0065,  ...,  0.0038,  0.0090,  0.0051],
          [-0.0061, -0.0009, -0.0030,  ...,  0.0327,  0.0336,  0.0333]]) 
  </code></pre>
  <p>My autoencoder is</p>
  <pre><code>class Autoencoder(nn.Module):
    def __init__(self):
      # N, 1, 28*28
      super().__init__()
      self.encoder = nn.Sequential(
          nn.Conv1d(1, 16, 5, stride = 10, padding  = 1),  # N, 16, 1639
          nn.ReLU(),
          nn.Conv1d(16, 32, 9, stride = 10, padding = 0), # N, 32, 164
          nn.ReLU(),
          nn.Conv1d(32, 64, 5, stride = 10, padding = 1), # N, 64, 17
          nn.ReLU(),
          nn.Conv1d(64, 128, 9, stride = 10, padding = 2), # N, 128, 2
      )
  
      # N, 64, 1, 1
      self.decoder = nn.Sequential(
          nn.ConvTranspose1d(128, 64, 9, stride = 10, padding = 2), # N, 64, 17
          nn.ReLU(),
          nn.ConvTranspose1d(64, 32, 5, stride = 10, padding = 1), # N, 32, 164 
          nn.ReLU(),
          nn.ConvTranspose1d(32, 16, 9, stride = 10, padding = 0), # N, 16, 1639
          nn.ReLU(),
          nn.ConvTranspose1d(16, 1, 5, stride = 10, padding = 1), # N, 1, 16384 
          nn.ReLU()
      )
    
    def forward(self, x):
      encoded = self.encoder(x)
      decoded = self.decoder(encoded)
      return decoded
  </code></pre>
  <p>At which point, I create the actual model</p>
  <pre><code>model = Autoencoder()
  criterion = nn.MSELoss()
  optimizer = torch.optim.Adam(model.parameters(), lr = 1e-3, weight_decay = 1e-5)
  </code></pre>
  <p>and which I then train and receive the following error</p>
  <pre><code>num_epochs = 10
  outputs = []
  dataTemp = [img for img in data_loader]
  halfData = dataTemp[0:len(dataTemp)//2]
  for epoch in range(num_epochs):
    for img in halfData:
      recon = model(img)
      loss = criterion(recon, img)
  
      optimizer.zero_grad()
      loss.backward()
      optimizer.step()
    
    print(f'Epoch:{epoch+1}, Loss:{loss.item():.4f}')
    outputs.append((epoch, img, recon))
  
  for img in dataTemp:
      recon = model(img)
      loss = criterion(recon, img)
  print(f'Final Loss:{loss.item():.4f}')
  ---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-68-78e6fd204df1&gt; in &lt;module&gt;()
        5 for epoch in range(num_epochs):
        6   for img in halfData:
  ----&gt; 7     recon = model(img)
        8     loss = criterion(recon, img)
        9 
  
  6 frames
  /usr/local/lib/python3.7/dist-packages/torch/nn/modules/conv.py in _conv_forward(self, input, weight, bias)
      293                             _single(0), self.dilation, self.groups)
      294         return F.conv1d(input, weight, bias, self.stride,
  --&gt; 295                         self.padding, self.dilation, self.groups)
      296 
      297     def forward(self, input: Tensor) -&gt; Tensor:
  
  TypeError: conv1d() received an invalid combination of arguments - got (list, Parameter, Parameter, tuple, tuple, tuple, int), but expected one of:
   * (Tensor input, Tensor weight, Tensor bias, tuple of ints stride, tuple of ints padding, tuple of ints dilation, int groups)
        didn't match because some of the arguments have invalid types: (!list!, !Parameter!, !Parameter!, !tuple!, !tuple!, !tuple!, int)
   * (Tensor input, Tensor weight, Tensor bias, tuple of ints stride, str padding, tuple of ints dilation, int groups)
        didn't match because some of the arguments have invalid types: (!list!, !Parameter!, !Parameter!, !tuple!, !tuple!, !tuple!, int)
  </code></pre>
  <p>I have absolutely no idea how to fix this. I am new to pytorch, so any help would be great :)!</p>