Skip to content

Commit

Permalink
Update pytorch_lightning/loggers/metrics_agg.py
Browse files Browse the repository at this point in the history
Co-Authored-By: Jirka Borovec <Borda@users.noreply.github.com>
  • Loading branch information
alexeykarnachev and Borda committed Apr 7, 2020
1 parent 39745aa commit 73a724a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pytorch_lightning/loggers/metrics_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def merge_two_dicts(d1: Mapping, d2: Mapping, fn: Callable[[float, float], float
{'a': 1.7, 'b': 2.2, 'c': 1}
"""

all_keys = list(set(d1.keys()).union(set(d2.keys())))

return {key: fn(d1.get(key, default_value), d2.get(key, default_value)) for key in all_keys}
keys = set(list(d1.keys()) + list(d2.keys()))
dx = {k: fn([v for v in (d1.get(k), d2.get(k)) if v]) for k in keys}
return dx


def metrics_agg_simple(metrics_to_agg: Sequence[MetricsT], fn: Callable[[float, float], float]) -> MetricsT:
Expand Down

0 comments on commit 73a724a

Please sign in to comment.