`
董瑞龙
  • 浏览: 105187 次
  • 性别: Icon_minigender_1
  • 来自: 青岛
社区版块
存档分类
最新评论

TensorFlow训练模型报错——莫烦学习例子3

阅读更多
运行莫烦TensorFlow教程报错,例子3
https://morvanzhou.github.io/tutorials/machine-learning/tensorflow/3-2-create-NN/

错误:
InternalError (see above for traceback): Blas GEMM launch failed : a.shape=(300, 1), b.shape=(1, 10), m=300, n=10, k=1
	 [[Node: MatMul = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device="/job:localhost/replica:0/task:0/gpu:0"](_arg_Placeholder_0_0/_7, Variable/read)]]


日志报错:
failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED

后查询资料
https://segmentfault.com/a/1190000009954640?utm_source=itdadao&utm_medium=referral

解决方案:
如果你是使用 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))

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics