{"record":{"id":"f9ae6b6e3d15dad2","repo":"keras-team/keras","slug":"there-is-no-implicit-conversions-from-float8-dtype","errorCode":null,"errorMessage":"There is no implicit conversions from float8 dtypes to others. You must cast it internally. Received: {dtypes}","messagePattern":"There is no implicit conversions from float8 dtypes to others\\. You must cast it internally\\. Received: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/common/dtypes.py","lineNumber":318,"sourceCode":"    \"bfloat16\"\n\n    >>> x = keras.ops.ones((1,), dtype=\"int32\")\n    >>> y = keras.ops.ones((1,), dtype=\"float32\")\n    >>> keras.backend.result_type(x.dtype, y.dtype)\n    \"float32\"\n\n    >>> z= keras.ops.ones((1,), dtype='complex64')\n    >>> keras.backend.result_type(z.dtype, int)\n    \"float64\"\n\n    \"\"\"\n    if len(dtypes) == 0:\n        # If no dtypes provided, default to floatx, this matches\n        # `ops.convert_to_tensor([])`\n        return config.floatx()\n    for dtype in dtypes:\n        if dtype in FLOAT8_TYPES:\n            raise ValueError(\n                \"There is no implicit conversions from float8 dtypes to others.\"\n                f\" You must cast it internally. Received: {dtypes}\"\n            )\n    return _lattice_result_type(\n        *(config.floatx() if arg is None else arg for arg in dtypes),\n    )\n","sourceCodeStart":300,"sourceCodeEnd":325,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/common/dtypes.py#L300-L325","documentation":"Guard in result_type: float8 dtypes (e.g. float8_e4m3fn) appear in the inputs to an implicit dtype-promotion decision. Keras deliberately disallows silent conversion of float8 to any other dtype because the precision loss is unsafe, so any promotion involving them must be an explicit cast.","triggerScenarios":"Thrown at keras/src/backend/common/dtypes.py:318 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Explicitly cast the float8 tensor to the target dtype with keras.ops.cast(x, 'float32') before mixing it with other dtypes.","Keep float8 tensors in dedicated quantization-aware paths rather than generic ops that promote dtypes.","Convert float8 storage to float16/bfloat16 at model boundaries if wider arithmetic is needed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}