log_dict#

MetricsLogger.log_dict(value_dict: Dict[str, Any], *, key: str | Tuple[str, ...] | None = None, reduce: str | None = 'mean', window: int | float | None = None, ema_coeff: float | None = None, percentiles: List[int] | bool | None = None, clear_on_reduce: bool | None = -1, with_throughput: bool | None = None, throughput_ema_coeff: float | None = -1, reduce_per_index_on_aggregate: bool | None = -1) → None[source]#

Logs all leafs of a possibly nested dict of values or Stats objects to this logger.

Traverses through all leafs of stats_dict and - if a path cannot be found in this logger yet, will add the Stats found at the leaf under that new key. If a path already exists, will merge the found leaf (Stats) with the ones already logged before. This way, stats_dict does NOT have to have the same structure as what has already been logged to self, but can be used to log values under new keys or nested key paths.

Passing a dict of stats objects allows you to merge dictionaries of stats objects that have been reduced by other, parallel components.

See MetricsLogger.log_value for more details on the arguments.

Parameters:
  • value_dict (Dict[str, Any]) – The possibly nested dict of values or Stats objects to log.

  • key (str | Tuple[str, ...] | None) – An optional key, or nested key tuple, to prefix the path of each leaf with.

  • reduce (str | None) – The reduction method. Passed to log_value() for each leaf.

  • window (int | float | None) – An optional window size. Passed to log_value() for each leaf.

  • ema_coeff (float | None) – An optional EMA coefficient. Passed to log_value() for each leaf.

  • percentiles (List[int] | bool | None) – The percentiles to compute. Passed to log_value() for each leaf.

  • clear_on_reduce (bool | None) – Deprecated. Use reduce="lifetime_sum" instead.

  • with_throughput (bool | None) – Whether to track a throughput estimate. Passed to log_value() for each leaf.

  • throughput_ema_coeff (float | None) – Deprecated.

  • reduce_per_index_on_aggregate (bool | None) – Deprecated.