# InternalError: cuDNN 初始化失败: CUDNN_STATUS_NOT_INITIALIZED

- **ID:** `tensorflow/cudnn-status-not-initialized`
- **领域:** tensorflow
- **类别:** gpu_error
- **错误码:** `CUDNN_INIT`
- **验证级别:** ai_generated
- **修复率:** 75%

## 根因

cuDNN 库初始化失败，通常是由于 CUDA/cuDNN 版本不兼容或 GPU 内存不足导致内部缓冲区分配失败。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| tensorflow 2.10.0 | active | — | — |
| tensorflow 2.11.0 | active | — | — |
| tensorflow 2.12.0 | active | — | — |

## 解决方案

1. ```
   Check and align CUDA and cuDNN versions by running `nvidia-smi` and `cat /usr/include/cudnn_version.h | grep CUDNN_MAJOR -A 2`. Then install matching TensorFlow: `pip install tensorflow==2.12.0`.
   ```
2. ```
   Set environment variable `export TF_CPP_MAX_VLOG_LEVEL=1` before running the script to get detailed cuDNN logs, then adjust library paths accordingly.
   ```

## 无效尝试

- **** — The issue is usually a system-level library mismatch, not a Python package problem. (90% 失败率)
- **** — Memory growth does not help with cuDNN initialization; it only controls dynamic allocation. (95% 失败率)
- **** — Older versions may have the same or worse cuDNN compatibility issues. (80% 失败率)
