[resolved] RuntimeError: unsupported tensor type DQN Flappy Bird

Hello everyone, I’m trying to do an agent which can play Flappy Bird game. I am following a pytorch example at

http://pytorch.org/tutorials/intermediate/reinforcement_q_learning.html,
and getting an error.

First, here is the file: https://github.com/darleybarreto/deep-reinforcement-learning/blob/master/dqn/dqn.py
The shape of the Tensors that goes into the convlayer is (n, k, h, w), i.e, (1, k, 80, 80). At each player actions, the tensor shape is (1, 4, 80, 80), that is, I am stacking the four last screens and passing through the net.
Now, as in the tutorial, doing this line below:

transitions = memory.sample(BATCH_SIZE) [line 166]
batch = Transition(*zip(*transitions)) [line 169]
state_batch = Variable(torch.cat(batch.state)) [line 173]

I’m ending up with a tensor of shape (512, 80, 80) and that was giving me an error.
So I did state_batch.view(1, *state_batch.size()) [line 181] ending up with another error at
[line 185] state_action_values = dqn(state_batch).gather(1, action_batch).

Here is the error:
```line 39, in conv2d
return f(input, weight, bias)
RuntimeError: unsupported tensor type`

Can someone explain to me whats going on?

I found whats wrong. When calling pygame.surfarray.array3d(display_surface) it gives me a ndarray of uint8 type (0 up to 255).