Post

Replies

Boosts

Views

Activity

Reply to Cannot assign a device for operation ReadVariableOp
I had the same error M2 Macs but none of the above suggestions worked for me. The error has got to do with data_augmentation layer of Keras Sequential model. Sample code producing errors: data_augmentation = keras.Sequential( [ layers.experimental.preprocessing.RandomFlip("horizontal"), layers.experimental.preprocessing.RandomRotation(0.1), layers.experimental.preprocessing.RandomZoom(0.1), ] ) model_1 = tf.keras.models.Sequential([ data_augmentation, tf.keras.layers.Conv2D(filters=32, kernel_size=(3,3)....... ....... ....... ..... Rather, i moved Data Augmentation to the Image Generator: train_datagen = ImageDataGenerator(rescale=1./255, rotation_range=0.2, # rotate the image slightly to up to 20% zoom_range=0.2, # zoom into the image up to 20% width_shift_range=0.2, # shift the image width ways up to 20% height_shift_range=0.2, # shift the image height ways up to 20% shear_range=0.2, # shear the image up to 20% horizontal_flip=True # flip the image on the horizontal axis ) building the model model_1 = tf.keras.models.Sequential([ tf.keras.layers.Conv2D(filters=32, kernel_size=(3,3).... ....... ...... .....
Topic: Machine Learning & AI SubTopic: General Tags:
May ’23