{
  "id": "pytorch/cuda-error-invalid-argument",
  "signature": "RuntimeError: CUDA error: invalid argument",
  "signature_zh": "运行时错误：CUDA错误：无效参数",
  "regex": "RuntimeError: CUDA error: invalid argument",
  "domain": "pytorch",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A CUDA kernel was launched with invalid arguments, often due to a tensor with a zero dimension or an illegal stride being passed to a CUDA operation.",
  "root_cause_type": "generic",
  "root_cause_zh": "CUDA内核启动时使用了无效参数，通常是因为向CUDA操作传递了零维度张量或非法步幅。",
  "versions": [
    {
      "version": "torch>=2.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "CUDA>=11.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Restarting the kernel or process does not fix the underlying invalid tensor argument.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Increasing batch size or memory allocation does not address the invalid argument error.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Check tensor shapes and strides before the operation. Ensure no dimension is zero and strides are valid. Print tensor.shape and tensor.stride() to debug.",
      "success_rate": 0.85,
      "how": "Check tensor shapes and strides before the operation. Ensure no dimension is zero and strides are valid. Print tensor.shape and tensor.stride() to debug.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use torch.cuda.synchronize() after the operation to get a more detailed traceback.",
      "success_rate": 0.7,
      "how": "Use torch.cuda.synchronize() after the operation to get a more detailed traceback.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Check tensor shapes and strides before the operation. Ensure no dimension is zero and strides are valid. Print tensor.shape and tensor.stride() to debug.",
    "Use torch.cuda.synchronize() after the operation to get a more detailed traceback."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://pytorch.org/docs/stable/notes/cuda.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.75,
  "resolvable": "true",
  "first_seen": "2023-03-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}