From 94f8348ffff548ce7eb271d2cb629f82568e5be7 Mon Sep 17 00:00:00 2001 From: kingh0730 <46679373+kingh0730@users.noreply.github.com> Date: Wed, 29 Nov 2023 00:27:22 +0000 Subject: [PATCH] works --- AutoCkt/ML/autockt_ml/autockt_gym.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/AutoCkt/ML/autockt_ml/autockt_gym.py b/AutoCkt/ML/autockt_ml/autockt_gym.py index e6098be..ad90523 100644 --- a/AutoCkt/ML/autockt_ml/autockt_gym.py +++ b/AutoCkt/ML/autockt_ml/autockt_gym.py @@ -1,3 +1,5 @@ +import datetime +from pathlib import Path from dataclasses import asdict # PyPI imports @@ -121,7 +123,23 @@ def step(self, action): ] ) - # TODO update env steps + # ----------------- Tensorboard ----------------- + log = { + "step": self.num_steps, + "done": done, + "reward": reward, + "action": action, + "curr_inputs": cur_params, + "curr_outputs": cur_spec, + "ideal_outputs": ideal_spec, + "curr_output_norm": cur_norm, + "ideal_output_norm": ideal_norm, + "observation": observation, + } + with open(self.log_file, "a") as f: + f.write(f"{log}\n") + + self.num_steps += 1 return observation, reward, done, {}