Skip to content
Snippets Groups Projects
Commit b400b67a authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Fix a deprecation warning and add better assert messages

parent 3f323d61
No related branches found
No related tags found
No related merge requests found
Pipeline #59516 passed
...@@ -137,7 +137,7 @@ def load(inputs): ...@@ -137,7 +137,7 @@ def load(inputs):
The data loaded from the given ``inputs``. The data loaded from the given ``inputs``.
""" """
from collections import Iterable from collections.abc import Iterable
import numpy import numpy
if _is_string(inputs): if _is_string(inputs):
if not os.path.exists(inputs): if not os.path.exists(inputs):
...@@ -401,9 +401,9 @@ def _generate_features(reader, paths, same_size=False): ...@@ -401,9 +401,9 @@ def _generate_features(reader, paths, same_size=False):
else: else:
# make sure all features have the same shape and dtype # make sure all features have the same shape and dtype
if same_size: if same_size:
assert shape == list(feature.shape) assert shape == list(feature.shape), f"Expected feature shape of {shape}, got {feature.shape}"
else: else:
assert shape[1:] == list(feature.shape[1:]) assert shape[1:] == list(feature.shape[1:]), f"Ignoring first dimension, expected feature shape of {shape}, got {feature.shape}"
assert dtype == feature.dtype assert dtype == feature.dtype
if same_size: if same_size:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment