From eccd142da0cdad7b62985403a7c3d5dfa539f3e2 Mon Sep 17 00:00:00 2001 From: hyeok9855 Date: Fri, 8 Sep 2023 15:30:21 +0900 Subject: [PATCH] minor refactoring to avoid pylance error --- hw1/cs285/infrastructure/rl_trainer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw1/cs285/infrastructure/rl_trainer.py b/hw1/cs285/infrastructure/rl_trainer.py index b78d8eb..1a36534 100644 --- a/hw1/cs285/infrastructure/rl_trainer.py +++ b/hw1/cs285/infrastructure/rl_trainer.py @@ -4,6 +4,7 @@ import time import gym +from gym import spaces import torch from cs285.infrastructure import pytorch_util as ptu @@ -49,7 +50,7 @@ def __init__(self, params): MAX_VIDEO_LEN = self.params['ep_len'] # Is this env continuous, or self.discrete? - discrete = isinstance(self.env.action_space, gym.spaces.Discrete) + discrete = isinstance(self.env.action_space, spaces.Discrete) # type: ignore self.params['agent_params']['discrete'] = discrete # Observation and action sizes