{"record":{"id":"cfa0454be1a37b78","repo":"keras-team/keras","slug":"if-imagenet-weights-are-being-loaded-alpha-must-b","errorCode":null,"errorMessage":"If imagenet weights are being loaded, alpha must be one of `0.35`, `0.50`, `0.75`, `1.0`, `1.3` or `1.4` only; Received `alpha={alpha}`","messagePattern":"If imagenet weights are being loaded, alpha must be one of `0\\.35`, `0\\.50`, `0\\.75`, `1\\.0`, `1\\.3` or `1\\.4` only; Received `alpha=(.+?)`","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/applications/mobilenet_v2.py","lineNumber":228,"sourceCode":"    input_shape = imagenet_utils.obtain_input_shape(\n        input_shape,\n        default_size=default_size,\n        min_size=32,\n        data_format=backend.image_data_format(),\n        require_flatten=include_top,\n        weights=weights,\n    )\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 alpha not in [0.35, 0.50, 0.75, 1.0, 1.3, 1.4]:\n            raise ValueError(\n                \"If imagenet weights are being loaded, \"\n                \"alpha must be one of `0.35`, `0.50`, `0.75`, \"\n                \"`1.0`, `1.3` or `1.4` only;\"\n                f\" Received `alpha={alpha}`\"\n            )\n\n        if rows != cols or rows not in [96, 128, 160, 192, 224]:\n            rows = 224\n            warnings.warn(\n                \"`input_shape` is undefined or non-square, \"\n                \"or `rows` is not in [96, 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":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/applications/mobilenet_v2.py#L210-L246","documentation":"Error \"If imagenet weights are being loaded, alpha must be one of `0.35`, `0.50`, `0.75`, `1.0`, `1.3` or `1.4` only; Received `alpha={alpha}`\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/applications/mobilenet_v2.py:228 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"}