openai / baselines

OpenAI Baselines: high-quality implementations of reinforcement learning algorithms
MIT License
15.75k stars 4.87k forks source link

Comment in ScaledFloatFrame of atari_wrappers #874

Open wwiiiii opened 5 years ago

wwiiiii commented 5 years ago

In ScaledFloatFrame function , there is comment like this.

    def observation(self, observation):
        # careful! This undoes the memory optimization, use
        # with smaller replay buffers only.
        return np.array(observation).astype(np.float32) / 255.0

I think the memory optimization in the comment is indicating the LazyFrames, but it seems optimization via reference sharing of duplicated frames is still valid because we stack the frames after the scaling.

Do I miss something? Is there any other memory optimization technique corrupted by ScaledFloatFrame?

MasterScrat commented 4 years ago

Curious about this too, since this code has been copy-pasted in many other libraries/frameworks, would be good to expend the explanation a bit.