{
  "id": "cuda/cudnn-bn-epsilon-nan",
  "signature": "RuntimeError: cuDNN error: CUDNN_STATUS_BAD_PARAM when setting batch normalization epsilon to 0",
  "signature_zh": "运行时错误：cuDNN 错误：将批量归一化 epsilon 设置为 0 时 CUDNN_STATUS_BAD_PARAM",
  "regex": "CUDNN_STATUS_BAD_PARAM when setting batch normalization epsilon",
  "domain": "cuda",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "cuDNN batch normalization requires a positive epsilon value to avoid division by zero; setting epsilon to 0 triggers a parameter validation error.",
  "root_cause_type": "generic",
  "root_cause_zh": "cuDNN 批量归一化需要正 epsilon 值以避免除以零；将 epsilon 设置为 0 会触发参数验证错误。",
  "versions": [
    {
      "version": "cuDNN 8.6",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "cuDNN 8.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PyTorch 2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PyTorch 2.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "While this avoids the error, it may cause numerical instability in batch normalization; recommended minimum is 1e-5.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This changes the model architecture and may degrade accuracy; overkill for a parameter fix.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Set epsilon to a positive value >= 1e-5 in the batch normalization layer definition. For PyTorch, use `nn.BatchNorm2d(num_features, eps=1e-5)`.",
      "success_rate": 0.95,
      "how": "Set epsilon to a positive value >= 1e-5 in the batch normalization layer definition. For PyTorch, use `nn.BatchNorm2d(num_features, eps=1e-5)`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If epsilon is loaded from a config file, add validation to clamp it to a minimum of 1e-5 before passing to the layer.",
      "success_rate": 0.9,
      "how": "If epsilon is loaded from a config file, add validation to clamp it to a minimum of 1e-5 before passing to the layer.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Set epsilon to a positive value >= 1e-5 in the batch normalization layer definition. For PyTorch, use `nn.BatchNorm2d(num_features, eps=1e-5)`.",
    "If epsilon is loaded from a config file, add validation to clamp it to a minimum of 1e-5 before passing to the layer."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.nvidia.com/deeplearning/cudnn/api/index.html#cudnn-batch-normalization",
  "official_doc_section": null,
  "error_code": "CUDNN_STATUS_BAD_PARAM",
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.95,
  "resolvable": "true",
  "first_seen": "2023-06-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}