Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions catalyst/contrib/data/collate_fn.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import collections
import collections.abc

from torch.utils.data.dataloader import default_collate

Expand Down Expand Up @@ -27,7 +27,7 @@ def __call__(self, batch):
Returns:
batch values filtered by `keys`
"""
if isinstance(batch[0], collections.Mapping):
if isinstance(batch[0], collections.abc.Mapping):
result = {}
for key in batch[0]:
items = [d[key] for d in batch]
Expand Down
5 changes: 3 additions & 2 deletions catalyst/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import argparse
from base64 import urlsafe_b64encode
import collections
import collections.abc
import copy
from datetime import datetime
from hashlib import sha256
Expand Down Expand Up @@ -203,7 +204,7 @@ def merge_dicts(*dicts: dict) -> dict:
if (
k in dict_
and isinstance(dict_[k], dict)
and isinstance(merge_dict[k], collections.Mapping)
and isinstance(merge_dict[k], collections.abc.Mapping)
):
dict_[k] = merge_dicts(dict_[k], merge_dict[k])
else:
Expand All @@ -230,7 +231,7 @@ def flatten_dict(
items = []
for key, value in dictionary.items():
new_key = parent_key + separator + key if parent_key else key
if isinstance(value, collections.MutableMapping):
if isinstance(value, collections.abc.MutableMapping):
items.extend(flatten_dict(value, new_key, separator=separator).items())
else:
items.append((new_key, value))
Expand Down