{"record":{"id":"608906eef2ecc8be","repo":"keras-team/keras","slug":"unsupported-reduction-reduction-608906","errorCode":null,"errorMessage":"Unsupported reduction: {reduction}","messagePattern":"Unsupported reduction: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/tensorflow/core.py","lineNumber":777,"sourceCode":"        # Use while_loop to handle both scalar and slice updates correctly\n        num_updates = tf.shape(indices)[0]\n\n        def body(i, result):\n            idx = indices[i : i + 1]  # Shape (1, index_depth)\n            current = tf.gather_nd(result, idx)  # Shape (1, *slice_shape)\n            new_value = (\n                current * updates[i]\n            )  # Maintains shape (1, *slice_shape)\n            return i + 1, tf.tensor_scatter_nd_update(result, idx, new_value)\n\n        _, result = tf.while_loop(\n            lambda i, _: i < num_updates,\n            body,\n            [0, inputs],\n        )\n        return result\n    else:\n        raise ValueError(f\"Unsupported reduction: {reduction}\")\n\n\ndef slice(inputs, start_indices, shape):\n    return tf.slice(inputs, start_indices, shape)\n\n\ndef slice_update(inputs, start_indices, updates):\n    return dynamic_update_slice(inputs, updates, start_indices)\n\n\ndef switch(index, branches, *operands):\n    index = convert_to_tensor(index, \"int32\")\n    index = tf.clip_by_value(index, 0, len(branches) - 1)\n\n    # Workaround to deal with python closures. More details:\n    # https://github.com/tensorflow/tensorflow/issues/8776#issuecomment-311383887\n    def gen_fn(i):\n        return lambda: branches[i](*operands)","sourceCodeStart":759,"sourceCodeEnd":795,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/tensorflow/core.py#L759-L795","documentation":"Error \"Unsupported reduction: {reduction}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/backend/tensorflow/core.py:777 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"}