{"record":{"id":"420299f72ba4107a","repo":"keras-team/keras","slug":"the-data-format-argument-must-be-one-of-channe","errorCode":null,"errorMessage":"The `data_format` argument must be one of {'channels_first', 'channels_last'}. Received: data_format={data_format}","messagePattern":"The `data_format` argument must be one of (.+?)\\. Received: data_format=(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/config.py","lineNumber":173,"sourceCode":"        data_format: string. `'channels_first'` or `'channels_last'`.\n\n    Examples:\n\n    >>> keras.config.image_data_format()\n    'channels_last'\n\n    >>> keras.config.set_image_data_format('channels_first')\n    >>> keras.config.image_data_format()\n    'channels_first'\n\n    >>> # Set it back to `'channels_last'`\n    >>> keras.config.set_image_data_format('channels_last')\n\n    \"\"\"\n    global _IMAGE_DATA_FORMAT\n    data_format = str(data_format).lower()\n    if data_format not in {\"channels_first\", \"channels_last\"}:\n        raise ValueError(\n            \"The `data_format` argument must be one of \"\n            \"{'channels_first', 'channels_last'}. \"\n            f\"Received: data_format={data_format}\"\n        )\n    _IMAGE_DATA_FORMAT = data_format\n\n\n@keras_export(\"keras.config.enable_flash_attention\")\ndef enable_flash_attention():\n    \"\"\"Enable flash attention.\n\n    Flash attention offers performance optimization for attention layers,\n    making it especially useful for large language models (LLMs) that\n    benefit from faster and more memory-efficient attention computations.\n\n    Once enabled, supported layers like `MultiHeadAttention` will **attempt** to\n    use flash attention for faster computations. By default, this feature is\n    enabled.","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/config.py#L155-L191","documentation":"Error \"The `data_format` argument must be one of {'channels_first', 'channels_last'}. Received: data_format={data_format}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/backend/config.py:173 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"}