close

[Solved] TensorFlow: Blas GEMM launch failed

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error TensorFlow: Blas GEMM launch failed in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How TensorFlow: Blas GEMM launch failed Error Occurs?

Today I get the following error TensorFlow: Blas GEMM launch failed in python.

How To Solve TensorFlow: Blas GEMM launch failed Error ?

  1. How To Solve TensorFlow: Blas GEMM launch failed Error ?

    To Solve TensorFlow: Blas GEMM launch failed Error Find the following in your keras/tensorflow_backend.py file you'll add config.gpu_options.allow_growth= True in both places

  2. TensorFlow: Blas GEMM launch failed

    To Solve TensorFlow: Blas GEMM launch failed Error Find the following in your keras/tensorflow_backend.py file you'll add config.gpu_options.allow_growth= True in both places

Solution 1

This worked for me on TensorFlow 2.1.0

import tensorflow as tf
physical_devices = tf.config.list_physical_devices('GPU') 
for device in physical_devices:
    tf.config.experimental.set_memory_growth(device, True)

Solution 2

It’s a simple fix, but it was a nightmare to figure it all out

On Windows I found the Keras install in Anaconda3\Lib\site-packages\keras

Find the following in your keras/tensorflow_backend.py file you’ll add config.gpu_options.allow_growth= True in both places

if _SESSION is None:
            if not os.environ.get('OMP_NUM_THREADS'):
                config = tf.ConfigProto(allow_soft_placement=True)
                config.gpu_options.allow_growth=True
            else:
                num_thread = int(os.environ.get('OMP_NUM_THREADS'))
                config = tf.ConfigProto(intra_op_parallelism_threads=num_thread,
                                        allow_soft_placement=True)
                config.gpu_options.allow_growth=True
            _SESSION = tf.Session(config=config)
        session = _SESSION

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read