'Tensorflow keras utility tool image-dataset-from-directory allocates all the dedicated gpu memory

so i am using tf.keras.utils.image_dataset_from_directory

and when i create a train batch using

train_data = tf.keras.utils.image_dataset_from_directory(process_data,
                                                         seed=42,
                                                         validation_split=0.2,
                                                         subset='training',
                                                         image_size=(img_height, img_width),
                                                         batch_size=batch_size)

it allocates all the gpu dedicated memory and i can't load any cnn model. i am using gtx 1660 ti (6 gb )



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source