sebtheiler / tutorials

All of the code for my Medium articles
https://medium.com/@sebastiankt9
MIT License
134 stars 107 forks source link

one question regarding the replay buffer in DQN atari project #7

Closed huanpass closed 4 years ago

huanpass commented 4 years ago

In the class "replay buffer", i found there is "states = np.transpose(np.asarray(states), axes=(0, 2, 3, 1))" in the def get_minibatch. The problem is why transpose needed here? It looks like the original sequence is already correct so don't need transpose operation here.

Many thanks!

sebtheiler commented 4 years ago

The transpose is just to take the state array from shape (32, 4, 84, 84), to (32, 84, 84, 4). The code could be programmed to work with either one, but in this case I decided to adopt (batch_size, height, width, stacked_frames) as the norm.

(Copied from my Medium response)