TensorFlow: Blas GEMM launch failed

后端 未结 15 1141
攒了一身酷
攒了一身酷 2020-12-05 05:11

When I\'m trying to use TensorFlow with Keras using the gpu, I\'m getting this error message:

C:\\Users\\nicol\\Anaconda3\\envs\\tensorflow\\lib\\site-packag         


        
15条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-05 05:34

    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

    sources:

    https://www.tensorflow.org/guide/using_gpu

    https://github.com/keras-team/keras/blob/master/keras/backend/tensorflow_backend.py

    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
    

提交回复
热议问题