Skip to content

Commit c6973e5

Browse files
committed
iter
1 parent 0252d39 commit c6973e5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

imblearn/keras/_generator.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@ def import_keras():
1515

1616
def import_from_keras():
1717
try:
18-
import keras
18+
import keras # noqa
1919

20-
return (keras.utils.Sequence,), True
20+
try:
21+
# Older versions of Keras provide the Sequence class directly in utils
22+
from keras.utils import Sequence
23+
except ImportError:
24+
from keras.utils.data_utils import Sequence
25+
26+
return (Sequence,), True
2127
except ImportError:
2228
return tuple(), False
2329

0 commit comments

Comments
 (0)