# InternalError: cuDNN RNN initialization failed: CUDNN_STATUS_BAD_PARAM

- **ID:** `tensorflow/internal-error-cudnn-rnn-init`
- **Domain:** tensorflow
- **Category:** gpu_error
- **Error Code:** `ICR`
- **Verification:** ai_generated
- **Fix Rate:** 75%

## Root Cause

cuDNN RNN layer initialization fails due to unsupported hidden size, batch size, or sequence length for the given cuDNN version.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| tensorflow 2.14.0 | active | — | — |
| cudnn 8.9.0 | active | — | — |

## Workarounds

1. **Reduce the hidden size or batch size to a value supported by cuDNN (e.g., hidden size divisible by 32 or 64):
model.add(tf.keras.layers.LSTM(units=256, return_sequences=True))
# Try units=128 or 64 if 256 fails** (80% success)
   ```
   Reduce the hidden size or batch size to a value supported by cuDNN (e.g., hidden size divisible by 32 or 64):
model.add(tf.keras.layers.LSTM(units=256, return_sequences=True))
# Try units=128 or 64 if 256 fails
   ```
2. **Set the environment variable TF_CUDNN_USE_AUTOTUNE=0 to disable cuDNN autotuning, which may bypass the BAD_PARAM error:
export TF_CUDNN_USE_AUTOTUNE=0
python train.py** (70% success)
   ```
   Set the environment variable TF_CUDNN_USE_AUTOTUNE=0 to disable cuDNN autotuning, which may bypass the BAD_PARAM error:
export TF_CUDNN_USE_AUTOTUNE=0
python train.py
   ```

## Dead Ends

- **** — The error is about invalid parameters, not memory. (90% fail)
- **** — Older cuDNN versions may not support required RNN operations. (75% fail)
