{"record":{"id":"6a1555651df7458f","repo":"keras-team/keras","slug":"input-should-have-its-axes-axes-fully-defined-r","errorCode":null,"errorMessage":"Input should have its {axes} axes fully-defined. Received: input.shape = {real.shape}","messagePattern":"Input should have its (.+?) axes fully-defined\\. Received: input\\.shape = (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/ops/math.py","lineNumber":595,"sourceCode":"        if real.shape != imag.shape:\n            raise ValueError(\n                \"Input `x` should be a tuple of two tensors - real and \"\n                \"imaginary. Both the real and imaginary parts should have the \"\n                f\"same shape. Received: x[0].shape = {real.shape}, \"\n                f\"x[1].shape = {imag.shape}\"\n            )\n        # We are calculating 2D FFT. Hence, rank >= 2.\n        if len(real.shape) < 2:\n            raise ValueError(\n                f\"Input should have rank >= 2. \"\n                f\"Received: input.shape = {real.shape}\"\n            )\n\n        # The axes along which we are calculating FFT should be fully-defined.\n        m = real.shape[axes[0]]\n        n = real.shape[axes[1]]\n        if m is None or n is None:\n            raise ValueError(\n                f\"Input should have its {axes} axes fully-defined. \"\n                f\"Received: input.shape = {real.shape}\"\n            )\n\n        return (\n            KerasTensor(shape=real.shape, dtype=real.dtype),\n            KerasTensor(shape=imag.shape, dtype=imag.dtype),\n        )\n\n    def call(self, x):\n        return backend.math.fft2(x)\n\n\n@keras_export(\"keras.ops.fft2\")\ndef fft2(x):\n    \"\"\"Computes the 2D Fast Fourier Transform along the last two axes of input.\n\n    Args:","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/ops/math.py#L577-L613","documentation":"fft2 needs both FFT axes (-2 and -1) fully defined at symbolic time; if either of the last two dimensions is None, the output shape cannot be computed and Keras raises. The message interpolates the axes tuple, e.g. 'Input should have its (-2, -1) axes fully-defined'.","triggerScenarios":"keras.Input(shape=(None, None)) feeding fft2 in a functional model; variable-height image inputs (dynamic H and W).","commonSituations":"Variable-resolution image models; eager code moved into a functional graph where dims become None.","solutions":["Fix both spatial dims: keras.Input(shape=(256, 256))","Resize all images to a fixed resolution before the FFT (resizing layer or preprocessing)","Bucket variable-size inputs to fixed sizes"],"exampleFix":"# before\ninputs = keras.Input(shape=(None, None, 1))\nout = keras.ops.fft2((inputs[..., 0], inputs[..., 0]))\n# after\ninputs = keras.Input(shape=(256, 256, 1))\nout = keras.ops.fft2((inputs[..., 0], inputs[..., 0]))","handlingStrategy":"validation","validationCode":"assert real.shape[-1] is not None and real.shape[-2] is not None","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fix spatial dims in keras.Input for fft2 models","Resize inputs to constant resolution"],"tags":["keras","fft2","dynamic-shape","functional-model"],"backgroundTag":"undefined-tensor-dimension","analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}