bugfix for test_async_env (#171)

This commit is contained in:
youkaichao 2020-07-28 20:06:01 +08:00 committed by GitHub
parent b7a4015db7
commit ad395b5235
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,7 +40,12 @@ def test_async_env(num=8, sleep=0.1):
env_ids = b.info.env_id
o.append(b)
current_index_start += len(action)
# len of action may be smaller than len(A) in the end
action = action_list[current_index_start: current_index_start + len(A)]
# truncate env_ids with the first terms
# typically len(env_ids) == len(A) == len(action), except for the
# last batch when actions are not enough
env_ids = env_ids[: len(action)]
spent_time = time.time() - spent_time
data = Batch.cat(o)
# assure 1/7 improvement