{
  "id": "tensorflow/tensor-broadcast-shape-error",
  "signature": "InvalidArgumentError: Incompatible shapes for broadcasting: [64, 128, 3] vs [64, 128, 4]",
  "signature_zh": "InvalidArgumentError: 广播形状不兼容: [64, 128, 3] 与 [64, 128, 4]",
  "regex": "Incompatible shapes for broadcasting.*vs",
  "domain": "tensorflow",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "Two tensors with incompatible last dimension sizes are being used in an element-wise operation that requires broadcasting.",
  "root_cause_type": "generic",
  "root_cause_zh": "两个张量的最后一个维度大小不兼容，在进行需要广播的逐元素操作时出错。",
  "versions": [
    {
      "version": "tensorflow 2.13.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"
    },
    {
      "version": "tensorflow 2.15.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Adding dimensions does not fix the last dimension mismatch; it only changes the rank.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Numpy operations break the computation graph and cannot be used in training.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Reshape or pad the smaller tensor to match the larger one. For example: `tensor_a = tf.pad(tensor_a, [[0,0], [0,0], [0,1]])` to add an extra channel.",
      "success_rate": 0.9,
      "how": "Reshape or pad the smaller tensor to match the larger one. For example: `tensor_a = tf.pad(tensor_a, [[0,0], [0,0], [0,1]])` to add an extra channel.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Reshape or pad the smaller tensor to match the larger one. For example: `tensor_a = tf.pad(tensor_a, [[0,0], [0,0], [0,1]])` to add an extra channel."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.tensorflow.org/guide/tensor",
  "official_doc_section": null,
  "error_code": "BROADCAST",
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2024-01-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}