keras-team/keras · error · ValueError
Invalid value for argument `output_mode`. Expected one of {'
Error message
Invalid value for argument `output_mode`. Expected one of {'int', 'one_hot'}. Received: output_mode={output_mode} What it means
Error "Invalid value for argument `output_mode`. Expected one of {'int', 'one_hot'}. Received: output_mode={output_mode}" thrown in keras-team/keras.
Source
Thrown at keras/src/layers/preprocessing/feature_space.py:21
from keras.src import backend
from keras.src import layers
from keras.src import tree
from keras.src.api_export import keras_export
from keras.src.layers.layer import Layer
from keras.src.layers.preprocessing.data_layer import DataLayer
from keras.src.saving import saving_lib
from keras.src.saving import serialization_lib
from keras.src.saving.keras_saveable import KerasSaveable
from keras.src.utils import backend_utils
from keras.src.utils.module_utils import tensorflow as tf
from keras.src.utils.naming import auto_name
from keras.src.utils.progbar import Progbar
class Cross(KerasSaveable):
def __init__(self, feature_names, crossing_dim, output_mode="one_hot"):
if output_mode not in {"int", "one_hot"}:
raise ValueError(
"Invalid value for argument `output_mode`. "
"Expected one of {'int', 'one_hot'}. "
f"Received: output_mode={output_mode}"
)
self.feature_names = tuple(feature_names)
self.crossing_dim = crossing_dim
self.output_mode = output_mode
def _obj_type(self):
return "Cross"
@property
def name(self):
return "_X_".join(self.feature_names)
def get_config(self):
return {
"feature_names": self.feature_names,View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/layers/preprocessing/feature_space.py:21 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of keras-team/keras@7a34a03db6 (2026-08-25).
Data as JSON: /api/errors/fa747ff8df91cd46.
Report an issue: GitHub.