keras-team/keras · error · ValueError
First dim of `coordinates` must be the same as the rank of `
Error message
First dim of `coordinates` must be the same as the rank of `inputs`. Received inputs with shape: {input_arr.shape} and coordinate leading dim of {coordinate_arrs.shape[0]} What it means
Error "First dim of `coordinates` must be the same as the rank of `inputs`. Received inputs with shape: {input_arr.shape} and coordinate leading dim of {coordinate_arrs.shape[0]}" thrown in keras-team/keras.
Source
Thrown at keras/src/backend/tensorflow/image.py:658
return [(index, weight)]
def _linear_indices_and_weights(coordinate):
lower = tf.floor(coordinate)
upper_weight = coordinate - lower
lower_weight = 1 - upper_weight
index = tf.cast(lower, tf.int32)
return [(index, lower_weight), (index + 1, upper_weight)]
def map_coordinates(
inputs, coordinates, order, fill_mode="constant", fill_value=0.0
):
input_arr = convert_to_tensor(inputs)
coordinate_arrs = convert_to_tensor(coordinates)
if coordinate_arrs.shape[0] != len(input_arr.shape):
raise ValueError(
"First dim of `coordinates` must be the same as the rank of "
"`inputs`. "
f"Received inputs with shape: {input_arr.shape} and coordinate "
f"leading dim of {coordinate_arrs.shape[0]}"
)
if len(coordinate_arrs.shape) < 2:
raise ValueError(
"Invalid coordinates rank: expected at least rank 2."
f" Received input with shape: {coordinate_arrs.shape}"
)
if fill_mode not in MAP_COORDINATES_FILL_MODES:
raise ValueError(
"Invalid value for argument `fill_mode`. Expected one of "
f"{set(MAP_COORDINATES_FILL_MODES.keys())}. Received: "
f"fill_mode={fill_mode}"
)
fill_value = convert_to_tensor(fill_value, dtype=input_arr.dtype)View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/backend/tensorflow/image.py:658 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/db2e068ab32dc0ba.
Report an issue: GitHub.