{"record":{"id":"f2c46a5ec8877000","repo":"keras-team/keras","slug":"invalid-value-received-for-argument-noise-shape-f2c46a","errorCode":null,"errorMessage":"Invalid value received for argument `noise_shape`. Expected all elements to be integers or None. Received element at index {i}: {dim} (type: {type(dim).__name__})","messagePattern":"Invalid value received for argument `noise_shape`\\. Expected all elements to be integers or None\\. Received element at index (.+?): (.+?) \\(type: (.+?)\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/regularization/dropout.py","lineNumber":83,"sourceCode":"                f\"Expected a tuple or list of integers. \"\n                f\"Received: noise_shape={noise_shape}\"\n            )\n\n        if not isinstance(noise_shape, tuple):\n            try:\n                noise_shape = tuple(noise_shape)\n            except TypeError:\n                raise ValueError(\n                    f\"Invalid value received for argument `noise_shape`. \"\n                    f\"Expected an iterable of integers \"\n                    f\"(e.g., a tuple or list). \"\n                    f\"Received: noise_shape={noise_shape}\"\n                )\n\n        for i, dim in enumerate(noise_shape):\n            if dim is not None:\n                if not isinstance(dim, int):\n                    raise ValueError(\n                        f\"Invalid value received for argument `noise_shape`. \"\n                        f\"Expected all elements to be integers or None. \"\n                        f\"Received element at index {i}: {dim} \"\n                        f\"(type: {type(dim).__name__})\"\n                    )\n\n                if dim <= 0:\n                    raise ValueError(\n                        f\"Invalid value received for argument `noise_shape`. \"\n                        f\"Expected all dimensions to be positive integers \"\n                        f\"or None. \"\n                        f\"Received negative or zero value at index {i}: {dim}\"\n                    )\n\n        return noise_shape\n\n    def call(self, inputs, training=False):\n        if training and self.rate > 0:","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/regularization/dropout.py#L65-L101","documentation":"Raised while Dropout._validate_noise_shape iterates over the elements of `noise_shape`: an entry that is not None and not a Python int (e.g. a float, numpy scalar, or string) fails the isinstance check and the whole shape is rejected. Each dimension must be an integer or None.","triggerScenarios":"Thrown at keras/src/layers/regularization/dropout.py:83 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Convert non-int entries to Python ints, e.g. noise_shape=(int(batch_size), 1, int(features))","Replace numpy scalars or floats with plain ints; use None only for dimensions that should follow the input shape"],"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"}