{
  "id": "tensorflow/graph-mode-retracing-warning",
  "signature": "WARNING:tensorflow:5 out of the last 5 calls to <function train_step> triggered tf.function retracing",
  "signature_zh": "WARNING:tensorflow:最近 5 次对 <function train_step> 的调用中有 5 次触发了 tf.function 重追踪",
  "regex": "out of the last.*calls to.*triggered tf\\.function retracing",
  "domain": "tensorflow",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The tf.function is being retraced repeatedly because the input tensor shapes or dtypes change between calls, which degrades performance.",
  "root_cause_type": "generic",
  "root_cause_zh": "tf.function 被反复重追踪，因为输入张量的形状或数据类型在调用之间发生变化，导致性能下降。",
  "versions": [
    {
      "version": "tensorflow 2.11.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "tensorflow 2.12.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "tensorflow 2.13.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This loses the performance benefits of graph execution and may cause other errors.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This can mask the issue but may lead to incorrect gradients or memory errors.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure all input tensors have consistent shapes and dtypes across batches. Pad variable-length inputs to a fixed shape using `tf.keras.preprocessing.sequence.pad_sequences`.",
      "success_rate": 0.85,
      "how": "Ensure all input tensors have consistent shapes and dtypes across batches. Pad variable-length inputs to a fixed shape using `tf.keras.preprocessing.sequence.pad_sequences`.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Ensure all input tensors have consistent shapes and dtypes across batches. Pad variable-length inputs to a fixed shape using `tf.keras.preprocessing.sequence.pad_sequences`."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.tensorflow.org/guide/function",
  "official_doc_section": null,
  "error_code": "RETRACE",
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2023-11-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}