Skip to content

Commit

Permalink
[RLlib] use Mapping instead of dict in summarize() to accommodate non…
Browse files Browse the repository at this point in the history
…-dict grads/params (e.g. haiku's frozendict) (ray-project#8793)
  • Loading branch information
KristianHolsheimer authored Jun 11, 2020
1 parent 700d81f commit ea965d7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rllib/utils/debug.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
import pprint
from typing import Mapping

from ray.rllib.policy.sample_batch import SampleBatch, MultiAgentBatch

Expand All @@ -17,7 +18,7 @@ def summarize(obj):


def _summarize(obj):
if isinstance(obj, dict):
if isinstance(obj, Mapping):
return {k: _summarize(v) for k, v in obj.items()}
elif hasattr(obj, "_asdict"):
return {
Expand Down

0 comments on commit ea965d7

Please sign in to comment.