{"record":{"id":"c506c230b7080c5c","repo":"keras-team/keras","slug":"if-imagenet-weights-are-being-loaded-alpha-can-be","errorCode":null,"errorMessage":"If imagenet weights are being loaded, alpha can be one of`0.25`, `0.50`, `0.75` or `1.0` only.  Received alpha={alpha}","messagePattern":"If imagenet weights are being loaded, alpha can be one of`0\\.25`, `0\\.50`, `0\\.75` or `1\\.0` only\\.  Received alpha=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/applications/mobilenet.py","lineNumber":167,"sourceCode":"    )\n\n    if backend.image_data_format() == \"channels_last\":\n        row_axis, col_axis = (0, 1)\n    else:\n        row_axis, col_axis = (1, 2)\n    rows = input_shape[row_axis]\n    cols = input_shape[col_axis]\n\n    if weights == \"imagenet\":\n        if depth_multiplier != 1:\n            raise ValueError(\n                \"If imagenet weights are being loaded, \"\n                \"depth multiplier must be 1.  \"\n                f\"Received depth_multiplier={depth_multiplier}\"\n            )\n\n        if alpha not in [0.25, 0.50, 0.75, 1.0]:\n            raise ValueError(\n                \"If imagenet weights are being loaded, \"\n                \"alpha can be one of\"\n                \"`0.25`, `0.50`, `0.75` or `1.0` only.  \"\n                f\"Received alpha={alpha}\"\n            )\n\n        if rows != cols or rows not in [128, 160, 192, 224]:\n            rows = 224\n            warnings.warn(\n                \"`input_shape` is undefined or non-square, \"\n                \"or `rows` is not in [128, 160, 192, 224]. \"\n                \"Weights for input shape (224, 224) will be \"\n                \"loaded as the default.\",\n                stacklevel=2,\n            )\n\n    if input_tensor is None:\n        img_input = layers.Input(shape=input_shape)","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/applications/mobilenet.py#L149-L185","documentation":"Error \"If imagenet weights are being loaded, alpha can be one of`0.25`, `0.50`, `0.75` or `1.0` only.  Received alpha={alpha}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/applications/mobilenet.py:167 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}