InternalError (see above for traceback): Blas GEMM launch failed

训练BiLSTM模型的时候报错:



InternalError (see above for traceback): Blas GEMM launch failed : a.shape=(32, 200), b.shape=(200, 400), m=32, n=400, k=200
[[node bilstm_crf/bidirectional_rnn/fw/fw/while/lstm_cell/MatMul (defined at train-nxf.py:48) ]]
[[node bilstm_crf/rnn_2/while/Switch_2 (defined at train-nxf.py:69) ]]



  


解决方法:


  如果你是使用 GPU 版 TensorFlow 的话,并且你想在显卡高占用率的情况下训练模型,那你要注意在初始化 Session 的时候为其分配固定数量的显存,否则可能会在开始训练的时候直接报错退出: 
这时你需要用下面的方法创建 Session:



gpu_options=tf.GPUOptions(per_process_gpu_memory_fraction=0.333)
sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))



  


参考文献:


【1】https://blog.csdn.net/orangefly0214/article/details/80978374