Browse Source

trying to log on every episode start

refactoring
sp 11 months ago
parent
commit
24badd36ac
  1. 3
      examples/shields/rl/callbacks.py

3
examples/shields/rl/callbacks.py

@ -33,6 +33,9 @@ class MyCallbacks(DefaultCallbacks):
tf.summary.text("first_text", "testing", step=0) tf.summary.text("first_text", "testing", step=0)
def on_episode_start(self, *, worker: RolloutWorker, base_env: BaseEnv, policies: Dict[PolicyID, Policy], episode, env_index, **kwargs) -> None: def on_episode_start(self, *, worker: RolloutWorker, base_env: BaseEnv, policies: Dict[PolicyID, Policy], episode, env_index, **kwargs) -> None:
file_writer = tf.summary.create_file_writer(algorithm.logdir)
with file_writer.as_default():
tf.summary.text("first_text", "testing", step=0)
# print(F"Epsiode started Environment: {base_env.get_sub_environments()}") # print(F"Epsiode started Environment: {base_env.get_sub_environments()}")
env = base_env.get_sub_environments()[0] env = base_env.get_sub_environments()[0]
episode.user_data["count"] = 0 episode.user_data["count"] = 0

Loading…
Cancel
Save