Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
197 views
in Technique[技术] by (71.8m points)

python - The model doen't fit withTensorflow and Keras Error with GPU

I installed cuda 11.0 and cudnn 8.0 with tensorflow-gpu 2.4.0. When I fit the model, I get this error.

UnknownError:  Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
     [[node sequential/conv2d/Relu (defined at <ipython-input-23-397fbbe99754>:1) ]] [Op:__inference_train_function_1671]

Function call stack:
train_function

I tried to install keras-gpu but the all environment and tensorflow doesn't work.

question from:https://stackoverflow.com/questions/66046177/the-model-doent-fit-withtensorflow-and-keras-error-with-gpu

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
import tensorflow as tf
gpu = tf.config.experimental.list_physical_devices('GPU')
print("Num GPUs Available: ", len(gpu))
tf.config.experimental.set_memory_growth(gpu[0], True)

This solves the error.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...