{"record":{"id":"9d4179ab3df84b5c","repo":"keras-team/keras","slug":"received-an-invalid-value-for-threshold-expecte","errorCode":null,"errorMessage":"Received an invalid value for `threshold`, expected a float or None. Received: threshold={threshold}","messagePattern":"Received an invalid value for `threshold`, expected a float or None\\. Received: threshold=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/core/ternary_dense.py","lineNumber":130,"sourceCode":"        threshold=None,\n        activation=None,\n        use_bias=True,\n        kernel_initializer=\"glorot_uniform\",\n        bias_initializer=\"zeros\",\n        kernel_regularizer=None,\n        bias_regularizer=None,\n        activity_regularizer=None,\n        kernel_constraint=None,\n        bias_constraint=None,\n        **kwargs,\n    ):\n        if not isinstance(units, int) or units <= 0:\n            raise ValueError(\n                \"Received an invalid value for `units`, expected a positive \"\n                f\"integer. Received: units={units}\"\n            )\n        if threshold is not None and not isinstance(threshold, (int, float)):\n            raise ValueError(\n                \"Received an invalid value for `threshold`, expected a float \"\n                f\"or None. Received: threshold={threshold}\"\n            )\n        if threshold is not None and threshold < 0:\n            raise ValueError(\n                \"Received an invalid value for `threshold`, expected a \"\n                \"non-negative float or None. \"\n                f\"Received: threshold={threshold}\"\n            )\n\n        super().__init__(activity_regularizer=activity_regularizer, **kwargs)\n        self.units = units\n        self.threshold = threshold\n        self.activation = activations.get(activation)\n        self.use_bias = use_bias\n        self.kernel_initializer = initializers.get(kernel_initializer)\n        self.bias_initializer = initializers.get(bias_initializer)\n        self.kernel_regularizer = regularizers.get(kernel_regularizer)","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/core/ternary_dense.py#L112-L148","documentation":"Error \"Received an invalid value for `threshold`, expected a float or None. Received: threshold={threshold}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/layers/core/ternary_dense.py:130 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"}