{
  "id": "tensorflow/cudnn-rnn-weight-format-error",
  "signature": "InternalError: CUDNN_STATUS_BAD_PARAM: Invalid weight format for cuDNN RNN. Expected format: [num_layers, input_size, num_units] but got [3, 128, 64].",
  "signature_zh": "InternalError: CUDNN_STATUS_BAD_PARAM: cuDNN RNN权重格式无效。期望格式：[num_layers, input_size, num_units]，但得到[3, 128, 64]。",
  "regex": "CUDNN_STATUS_BAD_PARAM: Invalid weight format for cuDNN RNN",
  "domain": "tensorflow",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The weight tensor passed to cuDNN RNN has an incorrect shape or layout, often due to a mismatch between the model's RNN configuration and the actual weight initialization.",
  "root_cause_type": "generic",
  "root_cause_zh": "传递给cuDNN RNN的权重张量形状或布局不正确，通常由模型的RNN配置与实际权重初始化之间的不匹配引起。",
  "versions": [
    {
      "version": "tensorflow==2.9.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "tensorflow==2.11.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "tensorflow==2.14.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Changing the RNN type (e.g., LSTM to GRU) does not fix the weight shape issue; it may introduce new shape requirements.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Increasing the number of units exacerbates the mismatch because weight dimensions become larger but still wrong.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "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.",
      "success_rate": 0.85,
      "how": "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.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use `tf.keras.layers.RNN` with a custom cell that explicitly defines weight shapes to avoid cuDNN assumptions.",
      "success_rate": 0.75,
      "how": "Use `tf.keras.layers.RNN` with a custom cell that explicitly defines weight shapes to avoid cuDNN assumptions.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "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.",
    "Use `tf.keras.layers.RNN` with a custom cell that explicitly defines weight shapes to avoid cuDNN assumptions."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.tensorflow.org/api_docs/python/tf/keras/layers/RNN",
  "official_doc_section": null,
  "error_code": "CRWF",
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2023-03-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}