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/numpy/image.py:1188
if need_squeeze:
transformed_images = np.squeeze(transformed_images, axis=0)
transformed_images = transformed_images.astype(input_dtype)
return transformed_images
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 = scale.astype(dtype)
translation = translation.astype(dtype)
return _scale_and_translate(
images,
output_shape,View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/backend/numpy/image.py:1188 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/cfc0f324fe0dd1d6.
Report an issue: GitHub.