# InternalError: CUDNN_STATUS_BAD_PARAM: cuDNN RNN权重格式无效。期望格式：[num_layers, input_size, num_units]，但得到[3, 128, 64]。

- **ID:** `tensorflow/cudnn-rnn-weight-format-error`
- **领域:** tensorflow
- **类别:** runtime_error
- **错误码:** `CRWF`
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

传递给cuDNN RNN的权重张量形状或布局不正确，通常由模型的RNN配置与实际权重初始化之间的不匹配引起。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| tensorflow==2.9.0 | active | — | — |
| tensorflow==2.11.0 | active | — | — |
| tensorflow==2.14.0 | active | — | — |

## 解决方案

1. ```
   Ensure the RNN layer is initialized with the correct input shape and units, and use `return_sequences=True` if the next layer expects 3D output.
   ```
2. ```
   Use `tf.keras.layers.RNN` with a custom cell that explicitly defines weight shapes to avoid cuDNN assumptions.
   ```

## 无效尝试

- **** — Changing the RNN type (e.g., LSTM to GRU) does not fix the weight shape issue; it may introduce new shape requirements. (85% 失败率)
- **** — Increasing the number of units exacerbates the mismatch because weight dimensions become larger but still wrong. (90% 失败率)
