{"record":{"id":"c8717be0d6988f1b","repo":"keras-team/keras","slug":"input-x-should-be-a-tuple-of-two-tensors-real-c8717b","errorCode":null,"errorMessage":"Input `x` should be a tuple of two tensors - real and imaginary.Both the real and imaginary parts should have the same shape. Received: x[0].shape = {real.shape}, x[1].shape = {imag.shape}","messagePattern":"Input `x` should be a tuple of two tensors - real and imaginary\\.Both the real and imaginary parts should have the same shape\\. Received: x\\[0\\]\\.shape = (.+?), x\\[1\\]\\.shape = (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/tensorflow/math.py","lineNumber":127,"sourceCode":"        axis=-1,\n        pad_end=False,\n    )\n\n\ndef _get_complex_tensor_from_tuple(x):\n    if not isinstance(x, (tuple, list)) or len(x) != 2:\n        raise ValueError(\n            \"Input `x` should be a tuple of two tensors - real and imaginary.\"\n            f\"Received: x={x}\"\n        )\n    # `convert_to_tensor` does not support passing complex tensors. We separate\n    # the input out into real and imaginary and convert them separately.\n    real, imag = x\n    real = convert_to_tensor(real)\n    imag = convert_to_tensor(imag)\n    # Check shapes.\n    if real.shape != imag.shape:\n        raise ValueError(\n            \"Input `x` should be a tuple of two tensors - real and imaginary.\"\n            \"Both the real and imaginary parts should have the same shape. \"\n            f\"Received: x[0].shape = {real.shape}, x[1].shape = {imag.shape}\"\n        )\n    # Ensure dtype is float.\n    if not real.dtype.is_floating or not imag.dtype.is_floating:\n        raise ValueError(\n            \"At least one tensor in input `x` is not of type float.\"\n            f\"Received: x={x}.\"\n        )\n    complex_input = tf.dtypes.complex(real, imag)\n    return complex_input\n\n\ndef fft(x):\n    complex_input = _get_complex_tensor_from_tuple(x)\n    complex_output = tf.signal.fft(complex_input)\n    return tf.math.real(complex_output), tf.math.imag(complex_output)","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/tensorflow/math.py#L109-L145","documentation":"Error \"Input `x` should be a tuple of two tensors - real and imaginary.Both the real and imaginary parts should have the same shape. Received: x[0].shape = {real.shape}, x[1].shape = {imag.shape}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/backend/tensorflow/math.py:127 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}