keras-team/keras · error · ValueError
Input `x` should be a tuple of two tensors - real and imagin
Error message
Input `x` should be a tuple of two tensors - real and imaginary.Received: x={x} What it means
Error "Input `x` should be a tuple of two tensors - real and imaginary.Received: x={x}" thrown in keras-team/keras.
Source
Thrown at keras/src/backend/tensorflow/math.py:116
if x.shape[-1] != y.shape[-1]:
raise ValueError("Last dimension of inputs to `cdist` must match")
diff = tf.expand_dims(x, -2) - tf.expand_dims(y, -3)
return tf.sqrt(tf.reduce_sum(tf.square(diff), axis=-1))
def extract_sequences(x, sequence_length, sequence_stride):
return tf.signal.frame(
x,
frame_length=sequence_length,
frame_step=sequence_stride,
axis=-1,
pad_end=False,
)
def _get_complex_tensor_from_tuple(x):
if not isinstance(x, (tuple, list)) or len(x) != 2:
raise ValueError(
"Input `x` should be a tuple of two tensors - real and imaginary."
f"Received: x={x}"
)
# `convert_to_tensor` does not support passing complex tensors. We separate
# the input out into real and imaginary and convert them separately.
real, imag = x
real = convert_to_tensor(real)
imag = convert_to_tensor(imag)
# Check shapes.
if real.shape != imag.shape:
raise ValueError(
"Input `x` should be a tuple of two tensors - real and imaginary."
"Both the real and imaginary parts should have the same shape. "
f"Received: x[0].shape = {real.shape}, x[1].shape = {imag.shape}"
)
# Ensure dtype is float.
if not real.dtype.is_floating or not imag.dtype.is_floating:
raise ValueError(View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/backend/tensorflow/math.py:116 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/75b49d0886acc429.
Report an issue: GitHub.