# RuntimeError: cuDNN error: CUDNN_STATUS_BAD_PARAM when calling cudnnRNNForwardTraining with input size mismatch

- **ID:** `cuda/cudnn-rnn-bad-dims`
- **Domain:** cuda
- **Category:** runtime_error
- **Error Code:** `CUDNN_STATUS_BAD_PARAM`
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The input tensor to an RNN layer has a feature dimension that does not match the expected input size defined in the cuDNN RNN descriptor, or the batch size is inconsistent between layers.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| cuDNN 8.9.2 | active | — | — |
| CUDA 12.0 | active | — | — |
| PyTorch 2.1.0 | active | — | — |
| TensorFlow 2.14 | active | — | — |

## Workarounds

1. **import torch; rnn = torch.nn.LSTM(input_size=128, hidden_size=256, num_layers=2); input_tensor = torch.randn(10, 32, 128); output, _ = rnn(input_tensor)** (90% success)
   ```
   import torch; rnn = torch.nn.LSTM(input_size=128, hidden_size=256, num_layers=2); input_tensor = torch.randn(10, 32, 128); output, _ = rnn(input_tensor)
   ```
2. **rnn = torch.nn.LSTM(input_size=128, hidden_size=256, batch_first=True); input_tensor = torch.randn(32, 10, 128)** (85% success)
   ```
   rnn = torch.nn.LSTM(input_size=128, hidden_size=256, batch_first=True); input_tensor = torch.randn(32, 10, 128)
   ```

## Dead Ends

- **** — Layer count does not affect the input dimension mismatch; the error is about the first layer's input size. (90% fail)
- **** — The input dimension requirement is independent of cell type; the mismatch persists. (85% fail)
