change env to vecenv for higher code coverage rate

This commit is contained in:
Trinkle23897 2020-03-18 21:56:03 +08:00
parent 64bab0b6a0
commit 9c5417dd51
2 changed files with 3 additions and 3 deletions

View File

@ -37,4 +37,4 @@ jobs:
- name: Test with pytest
run: |
pip install pytest pytest-cov
pytest --cov tianshou -s
pytest --cov tianshou

View File

@ -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)