code: def finalize(self):
      self.is_finalized = True
  
      info = {}
      for (
          policy_id,
          results_all_towers,
      ) in self.results_all_towers.items():
          # Reduce mean across all minibatch SGD steps (axis=0 to keep
          # all shapes as-is).
          info[policy_id] = tree.map_structure_with_path(
              _all_tower_reduce, *results_all_towers
          )
  
      return info
  
file_path: ray/python/ray/rllib/utils/metrics/learner_info.py
imports: from collections import defaultdict
  import numpy
  import tree
  from typing import Dict
  from ray.rllib.utils.annotations import DeveloperAPI
  from ray.rllib.policy.sample_batch import DEFAULT_POLICY_ID
  from ray.rllib.utils.typing import PolicyID
label_desc: Use image node_id 4 for calling the LearnerInfoBuilder obj's underlying member method code with example usage: obj.finalize() and returns: info