code: def record(self, record_dict, global_step):
      self.max_shaping_reward = max(
          self.max_shaping_reward, record_dict["episode_shaping_reward"]
      )
      self.max_x_offset_reward = max(
          self.max_x_offset_reward, record_dict["x_offset_reward"]
      )
      self.max_r2_reward = max(
          self.max_r2_reward, record_dict["episode_r2_reward"]
      )
  
      self.r2_reward_counter.feed(record_dict["episode_r2_reward"])
      if record_dict["episode_length"] >= 1000:  # no falldown
          self.nofall_r2_reward_counter.feed(
              record_dict["episode_r2_reward"]
          )
          self.falldown_counter100.feed(0.0)
      else:
          self.falldown_counter100.feed(1.0)
  
      for key in self.reward_loss_keys:
          self.reward_loss_counter[key].feed(record_dict[key])
      for key in self.vel_keys:
          self.vel_counter[key].feed(record_dict[key])
  
      self.summary.log_scalar(
          "performance/falldown_rate",
          self.falldown_counter100.sum / 100.0,
          global_step,
      )
      self.summary.log_scalar(
          "performance/max_r2_reward", self.max_r2_reward, global_step
      )
      self.summary.log_scalar(
          "performance/max_shaping_reward",
          self.max_shaping_reward,
          global_step,
      )
      self.summary.log_scalar(
          "performance/max_x_offset_reward",
          self.max_x_offset_reward,
          global_step,
      )
      self.summary.log_scalar(
          "performance/episode_r2_reward",
          record_dict["episode_r2_reward"],
          global_step,
      )
      self.summary.log_scalar(
          "performance/episode_shaping_reward",
          record_dict["episode_shaping_reward"],
          global_step,
      )
      self.summary.log_scalar(
          "performance/x_offset_reward",
          record_dict["x_offset_reward"],
          global_step,
      )
      self.summary.log_scalar(
          "performance/episode_length",
          record_dict["episode_length"],
          global_step,
      )
      self.summary.log_scalar(
          "performance/mean_action_l2_penalty",
          record_dict["mean_action_l2_penalty"],
          global_step,
      )
  
      self.summary.log_scalar(
          "server/free_client_num",
          record_dict["free_client_num"],
          global_step,
      )
  
      self.summary.log_scalar(
          "model/noiselevel", record_dict["noiselevel"], global_step
      )
      if self.critic_loss_counter.count > 0:
          mean_critic_loss = self.critic_loss_counter.mean
          self.summary.log_scalar(
              "model/critic_loss", mean_critic_loss, global_step
          )
  
      if self.r2_reward_counter.count > 400:
          mean_r2_reward = self.r2_reward_counter.mean
          self.summary.log_scalar(
              "performance/recent_r2_reward",
              mean_r2_reward,
              global_step,
          )
          mean_nofall_r2_reward = self.nofall_r2_reward_counter.mean
          self.summary.log_scalar(
              "performance/recent_nofall_r2_reward",
              mean_nofall_r2_reward,
              global_step,
          )
  
          for key in self.vel_keys:
              self.summary.log_scalar(
                  "scalar_vel/{}".format(key),
                  self.vel_counter[key].mean,
                  global_step,
              )
  
          for key in self.reward_loss_keys:
              if "first" in key:
                  self.summary.log_scalar(
                      "1_stage_loss_reward/" + key,
                      self.reward_loss_counter[key].mean,
                      global_step,
                  )
              elif "second" in key:
                  self.summary.log_scalar(
                      "2_stage_loss_reward/" + key,
                      self.reward_loss_counter[key].mean,
                      global_step,
                  )
              elif "third" in key:
                  self.summary.log_scalar(
                      "3_stage_loss_reward/" + key,
                      self.reward_loss_counter[key].mean,
                      global_step,
                  )
              elif "start" in key:
                  self.summary.log_scalar(
                      "0_stage_loss_reward/" + key,
                      self.reward_loss_counter[key].mean,
                      global_step,
                  )
              else:
                  self.summary.log_scalar(
                      "loss_reward/" + key,
                      self.reward_loss_counter[key].mean,
                      global_step,
                  )
          self.summary.log_scalar(
              "0_stage_loss_reward/stage_loss",
              self.reward_loss_counter["start_loss"].mean
              + self.reward_loss_counter["start_other_loss"].mean,
              global_step,
          )
          self.summary.log_scalar(
              "1_stage_loss_reward/stage_loss",
              self.reward_loss_counter["first_change_loss"].mean
              + self.reward_loss_counter[
                  "first_change_other_loss"
              ].mean,
              global_step,
          )
          self.summary.log_scalar(
              "2_stage_loss_reward/stage_loss",
              self.reward_loss_counter["second_change_loss"].mean
              + self.reward_loss_counter[
                  "second_change_other_loss"
              ].mean,
              global_step,
          )
          self.summary.log_scalar(
              "3_stage_loss_reward/stage_loss",
              self.reward_loss_counter["third_change_loss"].mean
              + self.reward_loss_counter[
                  "third_change_other_loss"
              ].mean,
              global_step,
          )
  
imports: import csv
  import numpy
  import tensorflow
  import os
  import six
label_desc: Use image node_id 3 for calling the ScalarsManager obj's underlying member method code with example usage: obj.record(record_dict, global_step) without return types