Skip to content

Commit

Permalink
fix ...
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed Jun 19, 2020
1 parent fbdb41d commit 33deec2
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions pytorch_lightning/loggers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@
import operator
from abc import ABC, abstractmethod
from argparse import Namespace
from typing import Union, Optional, Dict, Iterable, Any, Callable, List, Sequence, Mapping, Tuple
from typing import Union, Optional, Dict, Iterable, Any, Callable, List, Sequence, Mapping, Tuple, MutableMapping

import numpy as np
import torch

from pytorch_lightning.utilities import rank_zero_only
try:
from omegaconf import Container
except ImportError:
Container = None


class LightningLoggerBase(ABC):
"""
Expand Down Expand Up @@ -178,9 +172,9 @@ def _flatten_dict(params: Dict[str, Any], delimiter: str = '/') -> Dict[str, Any

def _dict_generator(input_dict, prefixes=None):
prefixes = prefixes[:] if prefixes else []
if isinstance(input_dict, (dict, DictConfig)):
if isinstance(input_dict, MutableMapping):
for key, value in input_dict.items():
if isinstance(value, (dict, DictConfig, Namespace)):
if isinstance(value, (MutableMapping, Namespace)):
value = vars(value) if isinstance(value, Namespace) else value
for d in _dict_generator(value, prefixes + [key]):
yield d
Expand Down

0 comments on commit 33deec2

Please sign in to comment.