keras-team/keras · error · ValueError

Invalid value for argument `method`. Expected of one {SCALE_

Error message

Invalid value for argument `method`. Expected of one {SCALE_AND_TRANSLATE_METHODS}. Received: method={method}

What it means

Error "Invalid value for argument `method`. Expected of one {SCALE_AND_TRANSLATE_METHODS}. Received: method={method}" thrown in keras-team/keras.

Source

Thrown at keras/src/backend/tensorflow/image.py:1059

    if use_rounding:
        output = tf.clip_by_value(
            tf.round(output), tf.reduce_min(x), tf.reduce_max(x)
        )
        output = tf.cast(output, x.dtype)
    return output


def scale_and_translate(
    images,
    output_shape,
    scale,
    translation,
    spatial_dims,
    method,
    antialias=True,
):
    if method not in SCALE_AND_TRANSLATE_METHODS:
        raise ValueError(
            "Invalid value for argument `method`. Expected of one "
            f"{SCALE_AND_TRANSLATE_METHODS}. Received: method={method}"
        )
    if method in ("linear", "bilinear", "trilinear", "triangle"):
        method = "linear"
    elif method in ("cubic", "bicubic", "tricubic"):
        method = "cubic"

    images = convert_to_tensor(images)
    scale = convert_to_tensor(scale)
    translation = convert_to_tensor(translation)
    kernel = _kernels[method]
    dtype = backend.result_type(scale.dtype, translation.dtype)
    scale = tf.cast(scale, dtype)
    translation = tf.cast(translation, dtype)
    return _scale_and_translate(
        images,
        output_shape,

View on GitHub (pinned to 7a34a03db6)

When it happens

Trigger: Thrown at keras/src/backend/tensorflow/image.py:1059 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/3b060c7cf4e8e207. Report an issue: GitHub.