Tensorflow crashes with CUBLAS_STATUS_ALLOC_FAILED

For TensorFlow 2.2 none of the other answers worked when the CUBLAS_STATUS_ALLOC_FAILED problem was encountered. Found a solution on https://www.tensorflow.org/guide/gpu: import tensorflow as tf gpus = tf.config.experimental.list_physical_devices(‘GPU’) if gpus: try: # Currently, memory growth needs to be the same across GPUs for gpu in gpus: tf.config.experimental.set_memory_growth(gpu, True) logical_gpus = tf.config.experimental.list_logical_devices(‘GPU’) print(len(gpus), “Physical GPUs,”, len(logical_gpus), “Logical … Read more

How to convert a grayscale image into a list of pixel values?

You can convert the image data into a Python list (or list-of-lists) like this: from PIL import Image img = Image.open(‘eggs.png’).convert(‘L’) # convert image to 8-bit grayscale WIDTH, HEIGHT = img.size data = list(img.getdata()) # convert image data to a list of integers # convert that to 2D list (list of lists of integers) data … Read more