环境:
- tensorflow2.3.0
- cuda10.1
- python3.8.3
- 未安装Keras,用的from tensorflow.keras import XXX
出错场景:
运行《python深度学习》(《Deep Learing with Python》)书中代码清单6-39时报错:
UnknownError: Fail to find the dnn implementation.
[[{{node CudnnRNN}}]] [[sequential/gru/PartitionedCall]] [Op:__inference_train_function_2948]
Function call stack: train_function -> train_function -> train_function
解决步骤;
- 重启内核
- 在第一个cell里面/程序首行,加入下列内容
from tensorflow.compat.v1 import ConfigProto
from tensorflow.compat.v1 import InteractiveSession
config = ConfigProto()
config.gpu_options.allow_growth = True
session = InteractiveSession(config=config)
就可以了
Reference
https://stackoverflow.com/questions/63315046/function-call-stack-train-function