keras-team/keras · error · ValueError
Invalid images rank: expected rank 3 (single image) or rank
Error message
Invalid images rank: expected rank 3 (single image) or rank 4 (batch of images). Received input with shape: images.shape={input_shape} What it means
Error "Invalid images rank: expected rank 3 (single image) or rank 4 (batch of images). Received input with shape: images.shape={input_shape}" thrown in keras-team/keras.
Source
Thrown at keras/src/backend/openvino/image.py:1492
).output(0)
# kernel1d_y has kW elements -> column vector [kW, 1]
kernel1d_y = ov_opset.reshape(
kernel1d_y,
ov_opset.constant([int(size[1]), 1], Type.i32).output(0),
False,
).output(0)
return ov_opset.multiply(kernel1d_y, kernel1d_x).output(0)
return _get_gaussian_kernel2d(kernel_size, sigma)
data_format = backend.standardize_data_format(data_format)
images = convert_to_tensor(images)
input_shape = images.shape
ov_type = get_ov_output(images).get_element_type()
if len(input_shape) not in (3, 4):
raise ValueError(
"Invalid images rank: expected rank 3 (single image) "
"or rank 4 (batch of images). Received input with shape: "
f"images.shape={input_shape}"
)
# bfloat16 is not supported by all OV ops used here; promote to f32.
# f16 constants in range() would mismatch with the f32 arithmetic
# constants in the kernel builder, so promote f16 to f32 as well.
compute_type = Type.f32 if ov_type in (Type.bf16, Type.f16) else ov_type
images = get_ov_output(images)
if compute_type != ov_type:
images = ov_opset.convert(images, compute_type).output(0)
need_squeeze = False
if len(input_shape) == 3:
images = ov_opset.unsqueeze(images, axes=[0]).output(0)
need_squeeze = True
View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/backend/openvino/image.py:1492 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/600b9adf40dbfe0c.
Report an issue: GitHub.