lcswillems / torch-ac

Recurrent and multi-process PyTorch implementation of deep reinforcement Actor-Critic algorithms A2C and PPO
MIT License
190 stars 65 forks source link

Small bug in algos/base.py #11

Open anniezhi opened 1 year ago

anniezhi commented 1 year ago

Hi, I think line 127 and line 167 both use 'i' as the enumerating index, but they form a nested loop. This can cause incorrect index referencing once 'done' is not full of 'False'.

lcswillems commented 1 year ago

Hi Xiaoying, I don't see the bug you are referring too. The variable i is not used after the for loop line 167, so how could it cause a bug?

anniezhi commented 1 year ago

Hi Lucas, Thanks for getting back. Variable 'i' is still used in the for loop started at line 127, after exiting the for loop in line 167. The for loop at line 167 is nested within the for loop at line 127.

anniezhi commented 1 year ago

I see. Index variables with the same name in nested loops do not cause problems anymore :) In that case the current code works perfectly.