{
  "id": "tensorflow/resource-exhausted-dataset-prefetch",
  "signature": "ResourceExhaustedError: Failed to allocate memory for prefetch queue",
  "signature_zh": "资源耗尽错误：无法为预取队列分配内存",
  "regex": "ResourceExhaustedError.*Failed to allocate memory for prefetch queue",
  "domain": "tensorflow",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "The tf.data pipeline's prefetch buffer consumes too much memory, often due to large dataset elements or excessive prefetch size.",
  "root_cause_type": "generic",
  "root_cause_zh": "tf.data管道的预取缓冲区消耗过多内存，通常是由于数据集元素过大或预取大小过大。",
  "versions": [
    {
      "version": "tensorflow 2.14.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "tensorflow 2.16.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Increasing overall GPU memory limit doesn't target prefetch buffer specifically.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Using more CPU cores for mapping can increase memory usage.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Reduce prefetch buffer size: dataset = dataset.prefetch(buffer_size=tf.data.AUTOTUNE) or set a fixed small value like 1.",
      "success_rate": 0.85,
      "how": "Reduce prefetch buffer size: dataset = dataset.prefetch(buffer_size=tf.data.AUTOTUNE) or set a fixed small value like 1.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use dataset.cache() to store processed elements on disk instead of memory.",
      "success_rate": 0.8,
      "how": "Use dataset.cache() to store processed elements on disk instead of memory.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Reduce element size by batching smaller or using lower-resolution images.",
      "success_rate": 0.75,
      "how": "Reduce element size by batching smaller or using lower-resolution images.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Reduce prefetch buffer size: dataset = dataset.prefetch(buffer_size=tf.data.AUTOTUNE) or set a fixed small value like 1.",
    "Use dataset.cache() to store processed elements on disk instead of memory.",
    "Reduce element size by batching smaller or using lower-resolution images."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.tensorflow.org/guide/data_performance",
  "official_doc_section": null,
  "error_code": "PRF",
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.8,
  "resolvable": "partial",
  "first_seen": "2024-02-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}