{"record":{"id":"95ae81ca8d381c45","repo":"keras-team/keras","slug":"hashedcrossing-should-be-called-on-a-list-or-tup","errorCode":null,"errorMessage":"`HashedCrossing` should be called on a list or tuple of inputs. Received: inputs={inputs}","messagePattern":"`HashedCrossing` should be called on a list or tuple of inputs\\. Received: inputs=(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/preprocessing/hashed_crossing.py","lineNumber":191,"sourceCode":"                depth=self.num_bins,\n                sparse=self.sparse,\n                dtype=self.compute_dtype,\n                backend_module=tf_backend,\n            )\n            return backend_utils.convert_tf_tensor(outputs, dtype=self.dtype)\n\n    def get_config(self):\n        return {\n            \"num_bins\": self.num_bins,\n            \"output_mode\": self.output_mode,\n            \"sparse\": self.sparse,\n            \"name\": self.name,\n            \"dtype\": self.dtype,\n        }\n\n    def _check_at_least_two_inputs(self, inputs):\n        if not isinstance(inputs, (list, tuple)):\n            raise ValueError(\n                \"`HashedCrossing` should be called on a list or tuple of \"\n                f\"inputs. Received: inputs={inputs}\"\n            )\n        if len(inputs) < 2:\n            raise ValueError(\n                \"`HashedCrossing` should be called on at least two inputs. \"\n                f\"Received: inputs={inputs}\"\n            )\n\n    def _check_input_shape_and_type(self, inputs):\n        first_shape = tuple(inputs[0].shape)\n        rank = len(first_shape)\n        if rank > 2 or (rank == 2 and first_shape[-1] != 1):\n            raise ValueError(\n                \"All `HashedCrossing` inputs should have shape `()`, \"\n                \"`(batch_size)` or `(batch_size, 1)`. \"\n                f\"Received: inputs={inputs}\"\n            )","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/preprocessing/hashed_crossing.py#L173-L209","documentation":"HashedCrossing.call validates that inputs arrive as a list or tuple, since a crossing needs multiple named inputs. A bare tensor or dict cannot be crossed.","triggerScenarios":"layer(single_tensor) instead of layer([t1, t2]); passing a dict of features; splatting the wrong variable.","commonSituations":"Passing a single tensor directly: layer(x1); passing a dict of features; splatting the wrong variable.","solutions":["Wrap inputs in a list: layer([x1, x2])","With a dict of features, extract two values: layer([d['a'], d['b']])","In Functional models, wire both Input nodes into the crossing layer"],"exampleFix":"// before\nout = layer(feature_a)\n// after\nout = layer([feature_a, feature_b])","handlingStrategy":"type-guard","validationCode":"assert isinstance(inputs, (list, tuple)), \"HashedCrossing expects a list/tuple of inputs\"","typeGuard":"def is_input_list(inputs):\n    return isinstance(inputs, (list, tuple)) and len(inputs) >= 2","tryCatchPattern":"catch ValueError from call() and wrap inputs in a list if a bare tensor was passed","preventionTips":["Pass a list of at least two tensors to HashedCrossing","Do not pass a single tensor or a dict"],"tags":["keras","hashed-crossing","input-type"],"backgroundTag":"invalid-input-type","analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}