This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.

tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.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/Conv2D (defined at /code/tf_google_certify/chp1/conv.py:27) ]] [Op:__inference_train_function_675]

Function call stack:
train_function

解决方法

添加如下代码

from tensorflow.compat.v1 import ConfigProto
from tensorflow.compat.v1 import InteractiveSession

config = ConfigProto()
config.gpu_options.allow_growth = True
session = InteractiveSession(config=config)

原文链接

https://github.com/tensorflow/tensorflow/issues/25160#issuecomment-782764092

posted @ 2023-06-12 10:44  Wangtn  阅读(62)  评论(0编辑  收藏  举报