I got AttributeError: ‘list’ object has no attribute ‘dim’ from this. My input for the LSTM is a list because the input supposed to be a time series input. But that creates a problem which I still I can’t seem to figure it out.
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim

import numpy as np
from tqdm import tqdm

inputs = [torch.randn(1,1,3) for _ in range(1)]



batch_size = 1
hidden = (torch.randn(1, 1, 3), torch.randn(1, 1, 3))


class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        
        self.lstm = nn.LSTM(3, 3, 1) #input_dim,output_dim and number of layer/depth 
        
        self.fc1 = nn.Linear(3,5)
        self.fc2 = nn.Linear(5,1)
        self.fc3 = nn.Linear(len(inputs),2)
        
    def RNN(self, inputs, hidden):
        
        for i in inputs:
            out, hidden = lstm(i.view(1, 1, -1), hidden)
            
        #out, hidden = lstm(inputs, hidden)
        
        #print(out,hidden)
        return out, hidden
        
    def forward(self, out):

        x = torch.tanh(self.fc1(out))
        x = torch.tanh(self.fc2(x))
        x = self.fc3(x.view(-1,len(inputs)))

        return x
        
    
        
net = Net()

output = net(inputs)
print(output)