TensorFlow training model error - don't bother to learn example 3

Running the Mofan TensorFlow tutorial reports an error, example 3
https://morvanzhou.github.io/tutorials/machine-learning/tensorflow/3-2-create-NN/Error

:
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)]]


The log reports:
failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED

and then query the data
https://segmentfault.com/a/1190000009954640?utm_source=itdadao&utm_medium=referral

Solution:
If you are using the GPU version of TensorFlow, and you want to use high graphics card usage In the case of training the model (such as playing games), then you should pay attention to allocating a fixed amount of video memory when initializing the session, otherwise it may directly report an error and exit when you start training:
then you need to use the following method to create a session :
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333)
sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326576089&siteId=291194637