From 9c5417dd517e178a35523f18c5182b9af85400af Mon Sep 17 00:00:00 2001 From: Trinkle23897 <463003665@qq.com> Date: Wed, 18 Mar 2020 21:56:03 +0800 Subject: [PATCH] change env to vecenv for higher code coverage rate --- .github/workflows/pytest.yml | 2 +- test/test_ddpg.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index b0d72a2..cae8385 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -37,4 +37,4 @@ jobs: - name: Test with pytest run: | pip install pytest pytest-cov - pytest --cov tianshou -s + pytest --cov tianshou diff --git a/test/test_ddpg.py b/test/test_ddpg.py index 3dcc962..1f808e9 100644 --- a/test/test_ddpg.py +++ b/test/test_ddpg.py @@ -8,9 +8,9 @@ from torch import nn from torch.utils.tensorboard import SummaryWriter from tianshou.policy import DDPGPolicy -from tianshou.env import SubprocVectorEnv from tianshou.utils import tqdm_config, MovAvg from tianshou.data import Collector, ReplayBuffer +from tianshou.env import VectorEnv, SubprocVectorEnv class Actor(nn.Module): @@ -92,7 +92,7 @@ def test_ddpg(args=get_args()): args.action_shape = env.action_space.shape or env.action_space.n args.max_action = env.action_space.high[0] # train_envs = gym.make(args.task) - train_envs = SubprocVectorEnv( + train_envs = VectorEnv( [lambda: gym.make(args.task) for _ in range(args.training_num)], reset_after_done=True) # test_envs = gym.make(args.task)