tensorflow.python.framework.errors_impl.UnknownError: Failed to get convolution algorithm. This is p

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. [Op:Conv2D]

用tf.keras.layers.Conv2D计算输出:

tensorflow.python.framework.errors_impl.UnknownError: Failed to get convolution algorithm. This is p_第1张图片

1.内存不足:mnist数据集有过,设置动态分配内存即可
而此处不行

2.tensorflow和cudnn或cuda版本不对应:
。。。
tensorflow.python.framework.errors_impl.UnknownError: Failed to get convolution algorithm. This is p_第2张图片
是对应的。

由于是将cudnn另起一个文件夹设置的环境变量。。

后面重新把cudnn通过复制粘贴的方式放到对应的cuda文件夹,可以正常运行了。

解决:
tensorflow.python.framework.errors_impl.UnknownError: Failed to get convolution algorithm. This is p_第3张图片

D:\Anaconda3\envs\tf20\python.exe D:/PycharmProjects/tf20_1st/error.py
2020-01-11 14:05:54.963919: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
2020-01-11 14:05:57.229253: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-01-11 14:05:57.297777: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties: 
name: GeForce GTX 1050 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.468
pciBusID: 0000:01:00.0
2020-01-11 14:05:57.297914: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2020-01-11 14:05:57.298323: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2020-01-11 14:05:57.298598: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-01-11 14:05:57.300111: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties: 
name: GeForce GTX 1050 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.468
pciBusID: 0000:01:00.0
2020-01-11 14:05:57.300245: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2020-01-11 14:05:57.300652: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2020-01-11 14:05:57.927553: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-01-11 14:05:57.927645: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165]      0 
2020-01-11 14:05:57.927696: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0:   N 
2020-01-11 14:05:57.928110: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2996 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1050 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1)
2020-01-11 14:05:58.107859: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2020-01-11 14:05:59.197239: W tensorflow/stream_executor/cuda/redzone_allocator.cc:312] Internal: Invoking ptxas not supported on Windows
Relying on driver to perform ptx compilation. This message will be only logged once.

进程已结束,退出代码 0

在这里插入图片描述

你可能感兴趣的:(TensorFlow)