keras-team/keras · error · TypeError

Expected an int or a list/tuple of ints for the argument 'ax

Error message

Expected an int or a list/tuple of ints for the argument 'axis', but received: %r

What it means

Error "Expected an int or a list/tuple of ints for the argument 'axis', but received: %r" thrown in keras-team/keras.

Source

Thrown at keras/src/layers/normalization/layer_normalization.py:135

        gamma_constraint=None,
        **kwargs,
    ):
        rms_scaling = kwargs.pop("rms_scaling", False)
        if rms_scaling:
            warnings.warn(
                "You passed `rms_scaling=True`, which is deprecated. This "
                "argument incorrectly scales the input by the variance, not "
                "the root mean square. To correctly use RMS Normalization, "
                "please use `keras.layers.RMSNormalization` instead."
            )

        super().__init__(**kwargs)
        if isinstance(axis, (list, tuple)):
            self.axis = list(axis)
        elif isinstance(axis, int):
            self.axis = axis
        else:
            raise TypeError(
                "Expected an int or a list/tuple of ints for the "
                "argument 'axis', but received: %r" % axis
            )

        self.epsilon = epsilon
        self.center = center
        self.scale = scale
        self.rms_scaling = rms_scaling
        self.beta_initializer = initializers.get(beta_initializer)
        self.gamma_initializer = initializers.get(gamma_initializer)
        self.beta_regularizer = regularizers.get(beta_regularizer)
        self.gamma_regularizer = regularizers.get(gamma_regularizer)
        self.beta_constraint = constraints.get(beta_constraint)
        self.gamma_constraint = constraints.get(gamma_constraint)

        self.supports_masking = True
        self.autocast = False

View on GitHub (pinned to 7a34a03db6)

When it happens

Trigger: Thrown at keras/src/layers/normalization/layer_normalization.py:135 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/ed6923d2564c1ff5. Report an issue: GitHub.