Reputation: 95
I am using Google Colab, and i tried to import HDF5Matrix class from keras.utils or keras.utils..io_utils, but i keep getting an error as you can see in the picture below:
The error is :
ImportError: cannot import name 'HDF5Matrix' from 'tensorflow.keras.utils' (/usr/local/lib/python3.7/dist-packages/tensorflow/keras/utils/__init__.py)
Upvotes: 0
Views: 2975
Reputation: 3158
I think you are on 2.4.1.
print(tf.version.VERSION) # 2.4.1
As a workaround:
pls try to go to the previous version and it should work okay.
!pip install tensorflow==2.3.1 # install 2.3.1
import os
import tensorflow as tf
from tensorflow import keras
print(tf.version.VERSION)
from tensorflow.keras.utils import HDF5Matrix
Upvotes: 2