From 9b16819fc590cc7f33101f456384c7e6e027a7a0 Mon Sep 17 00:00:00 2001 From: Erik Nygren <erik.nygren@sbb.ch> Date: Sun, 1 Sep 2019 14:09:35 -0400 Subject: [PATCH] fixed bug where all values are infinite --- torch_training/render_agent_behavior.py | 3 +-- utils/observation_utils.py | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/torch_training/render_agent_behavior.py b/torch_training/render_agent_behavior.py index 651ec3e..f41cbb9 100644 --- a/torch_training/render_agent_behavior.py +++ b/torch_training/render_agent_behavior.py @@ -96,14 +96,13 @@ action_dict = dict() final_action_dict = dict() scores_window = deque(maxlen=100) done_window = deque(maxlen=100) -time_obs = deque(maxlen=2) scores = [] dones_list = [] action_prob = [0] * action_size agent_obs = [None] * env.get_num_agents() agent_next_obs = [None] * env.get_num_agents() agent = Agent(state_size, action_size, "FC", 0) -with path(torch_training.Nets, "navigator_checkpoint500.pth") as file_in: +with path(torch_training.Nets, "navigator_checkpoint1100.pth") as file_in: agent.qnetwork_local.load_state_dict(torch.load(file_in)) record_images = False diff --git a/utils/observation_utils.py b/utils/observation_utils.py index 7352601..be66a41 100644 --- a/utils/observation_utils.py +++ b/utils/observation_utils.py @@ -45,6 +45,8 @@ def norm_obs_clip(obs, clip_min=-1, clip_max=1, fixed_radius=0, normalize_to_ran min_obs = 0 # min(max_obs, min_gt(obs, 0)) if normalize_to_range: min_obs = min_gt(obs, 0) + if min_obs > max_obs: + min_obs = max_obs if max_obs == min_obs: return np.clip(np.array(obs) / max_obs, clip_min, clip_max) norm = np.abs(max_obs - min_obs) -- GitLab