I am getting the bellow error message:
Traceback (most recent call last):

  File "C:\Users\Sam\Desktop\Bitcoin\Q_Learning\DQN_NEW_Original.py", line 122, in <module>
    agent = Agent(lr=0.001, input_dims=env.observation_space.shape, n_actions=env.action_space.n)

  File "C:\Users\Sam\Desktop\Bitcoin\Q_Learning\DQN_NEW_Original.py", line 57, in __init__
    self.Q = LinearDQN(self.lr, self.n_actions, self.input_dims)

  File "C:\Users\Sam\Desktop\Bitcoin\Q_Learning\DQN_NEW_Original.py", line 22, in __init__
    self.fc1 = T.flatten(nn.Linear(*input_dims, 128))

TypeError: flatten(): argument 'input' (position 1) must be Tensor, not Linear


runfile('C:/Users/Sam/Desktop/Bitcoin/Q_Learning/DQN_NEW_Original.py', wdir='C:/Users/Sam/Desktop/Bitcoin/Q_Learning')
  File "C:\Users\Sam\Desktop\Bitcoin\Q_Learning\DQN_NEW_Original.py", line 37
    actions = self.fc2(layer1)
    ^
SyntaxError: invalid syntax


runfile('C:/Users/Sam/Desktop/Bitcoin/Q_Learning/DQN_NEW_Original.py', wdir='C:/Users/Sam/Desktop/Bitcoin/Q_Learning')
Traceback (most recent call last):

  File "C:\Users\Sam\Desktop\Bitcoin\Q_Learning\DQN_NEW_Original.py", line 133, in <module>
    agent.learn(obs, action, reward, obs_)

  File "C:\Users\Sam\Desktop\Bitcoin\Q_Learning\DQN_NEW_Original.py", line 80, in learn
    q_pred = self.Q.forward(states)[actions]

  File "C:\Users\Sam\Desktop\Bitcoin\Q_Learning\DQN_NEW_Original.py", line 36, in forward
    layer1 = F.relu(T.flatten(self.fc1(state)))

  File "C:\Users\Sam\anaconda3\envs\tensorflow2\lib\site-packages\torch\nn\modules\module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)

  File "C:\Users\Sam\anaconda3\envs\tensorflow2\lib\site-packages\torch\nn\modules\linear.py", line 87, in forward
    return F.linear(input, self.weight, self.bias)

  File "C:\Users\Sam\anaconda3\envs\tensorflow2\lib\site-packages\torch\nn\functional.py", line 1610, in linear
    ret = torch.addmm(bias, input, weight.t())

RuntimeError: size mismatch, m1: [30 x 2], m2: [30 x 2] at C:/w/b/windows/pytorch/aten/src\THC/generic/THCTensorMathBlas.cu:283 


Here is my network setup:
     super(LinearDQN, self).__init__()
     self.fc1 = nn.Linear(*input_dims, 128)
     self.fc2 = nn.Linear(128, n_actions) 

The input dims are [30,2] and n_actions is 2.
Also note that the error ‘m1: [30 x 2]’ increases in multiples of my batch size (no idea why).
Cheers all,