keras-team/keras · error · ValueError
`interpolation` argument should be one of
Error message
`interpolation` argument should be one of: "{interploations_list}. Received: "{interpolation}". What it means
Raised by the deprecated resize_images when the interpolation string does not match any key of the supported interpolations dict ('area', 'bicubic', 'bilinear', 'gaussian', 'lanczos3', 'lanczos5', 'mitchellcubic', 'nearest'). The string is used to select a tf.image.ResizeMethod, so unknown spellings cannot be mapped to a method.
Solutions
- Use one of the supported interpolation names: area, bicubic, bilinear, gaussian, lanczos3, lanczos5, mitchellcubic, nearest
- Check for misspellings such as 'cubic' (use 'bicubic') or 'nearest_neighbor' (use 'nearest')
- Note this legacy helper only supports this fixed set; newer APIs may support different names
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at keras/src/legacy/backend.py:1384 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/22f13eb87ef2a2fb.
Report an issue: GitHub.
Appendix: source
Thrown at keras/src/legacy/backend.py:1384
)
if data_format == "channels_first":
x = permute_dimensions(x, [0, 2, 3, 1])
interpolations = {
"area": tf.image.ResizeMethod.AREA,
"bicubic": tf.image.ResizeMethod.BICUBIC,
"bilinear": tf.image.ResizeMethod.BILINEAR,
"gaussian": tf.image.ResizeMethod.GAUSSIAN,
"lanczos3": tf.image.ResizeMethod.LANCZOS3,
"lanczos5": tf.image.ResizeMethod.LANCZOS5,
"mitchellcubic": tf.image.ResizeMethod.MITCHELLCUBIC,
"nearest": tf.image.ResizeMethod.NEAREST_NEIGHBOR,
}
interploations_list = '"' + '", "'.join(interpolations.keys()) + '"'
if interpolation in interpolations:
x = tf.image.resize(x, new_shape, method=interpolations[interpolation])
else:
raise ValueError(
"`interpolation` argument should be one of: "
f'{interploations_list}. Received: "{interpolation}".'
)
if data_format == "channels_first":
x = permute_dimensions(x, [0, 3, 1, 2])
return x
@keras_export("keras._legacy.backend.resize_volumes")
def resize_volumes(x, depth_factor, height_factor, width_factor, data_format):
"""DEPRECATED."""
if data_format == "channels_first":
output = repeat_elements(x, depth_factor, axis=2)
output = repeat_elements(output, height_factor, axis=3)
output = repeat_elements(output, width_factor, axis=4)
return output
elif data_format == "channels_last":View on GitHub (pinned to 7a34a03db6)