keras-team/keras · error · ValueError

dmax should be non-negative in the `renorm_clipping` argumen

Error message

dmax should be non-negative in the `renorm_clipping` argument. Received: dmax={dmax}.

What it means

Error "dmax should be non-negative in the `renorm_clipping` argument. Received: dmax={dmax}." thrown in keras-team/keras.

Source

Thrown at keras/src/layers/normalization/batch_normalization.py:226

        if renorm:
            renorm_clipping = renorm_clipping or {}
            keys = ["rmax", "rmin", "dmax"]
            if set(renorm_clipping) - set(keys):
                raise ValueError(
                    "Received invalid keys for `renorm_clipping` argument: "
                    f"{renorm_clipping}. Supported values: {keys}."
                )
            rmax = renorm_clipping.get("rmax")
            rmin = renorm_clipping.get("rmin")
            dmax = renorm_clipping.get("dmax")

            if rmax is not None and rmin is not None and rmax < rmin:
                raise ValueError(
                    "rmax should be greater than rmin in the `renorm_clipping` "
                    "argument. Received: rmax={rmax}, rmin={rmin}."
                )
            if dmax is not None and dmax < 0:
                raise ValueError(
                    "dmax should be non-negative in the `renorm_clipping` "
                    """argument. Received: dmax={dmax}."""
                )

        self.renorm_clipping = renorm_clipping
        self.renorm_momentum = renorm_momentum

        self.gamma = None
        self.beta = None
        self.moving_mean = None
        self.moving_variance = None
        self._reduction_axes = None

    def build(self, input_shape):
        shape = (input_shape[self.axis],)
        if self.scale:
            self.gamma = self.add_weight(
                shape=shape,

View on GitHub (pinned to 7a34a03db6)

When it happens

Trigger: Thrown at keras/src/layers/normalization/batch_normalization.py:226 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/ef9786abd31d490a. Report an issue: GitHub.