Skip to content

Conversation

wwiiiii
Copy link
Contributor

@wwiiiii wwiiiii commented Apr 16, 2019

In current version, indexing i-th element of LazyFrame return wrong result.
It stores the stacked frame in (height, width, channel) format but using first axis -which is height- when indexing, therefore return value has (width, channel) shape.


from baselines.common.atari_wrappers import make_atari, wrap_deepmind

env = wrap_deepmind(make_atari('PongNoFrameskip-v4'), frame_stack=True)

state = env.reset()
print(type(state))
print(state[0].shape)

The result of above snippet is

<class 'baselines.common.atari_wrappers.LazyFrames'>
(84, 4)

for now, but it would be

<class 'baselines.common.atari_wrappers.LazyFrames'>
(84, 84)

after the fix.

Indexing LazyFrames with index i should return the single channel frame
@pzhokhov pzhokhov merged commit 5d8041d into openai:master Apr 19, 2019
@pzhokhov
Copy link
Collaborator

see discussion here: #907 - the snippet above should now change into

from baselines.common.atari_wrappers import make_atari, wrap_deepmind
env = wrap_deepmind(make_atari('PongNoFrameskip-v4'), frame_stack=True)
state = env.reset()
print(type(state))
print(state.frame(0).shape)

this way, the behaviour of LazyFrames is consistent with numpy arrays.

kkonen pushed a commit to kkonen/baselines-1 that referenced this pull request Sep 26, 2019
Indexing LazyFrames with index i should return the single channel frame
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants