keras-team/keras · error · TypeError
Invalid input type. Expected `float32` or `float64`. Receive
Error message
Invalid input type. Expected `float32` or `float64`. Received: input type={x.dtype} What it means
Error "Invalid input type. Expected `float32` or `float64`. Received: input type={x.dtype}" thrown in keras-team/keras.
Source
Thrown at keras/src/backend/jax/ops/math.py:167
complex_output = jnp.fft.ifft2(complex_input)
return jnp.real(complex_output), jnp.imag(complex_output)
def rfft(x, fft_length=None):
complex_output = jnp.fft.rfft(x, n=fft_length, axis=-1, norm="backward")
return jnp.real(complex_output), jnp.imag(complex_output)
def irfft(x, fft_length=None):
complex_input = _get_complex_tensor_from_tuple(x)
return jnp.fft.irfft(complex_input, n=fft_length, axis=-1, norm="backward")
def stft(
x, sequence_length, sequence_stride, fft_length, window="hann", center=True
):
if standardize_dtype(x.dtype) not in {"float32", "float64"}:
raise TypeError(
"Invalid input type. Expected `float32` or `float64`. "
f"Received: input type={x.dtype}"
)
if fft_length < sequence_length:
raise ValueError(
"`fft_length` must equal or larger than `sequence_length`. "
f"Received: sequence_length={sequence_length}, "
f"fft_length={fft_length}"
)
if isinstance(window, str):
if window not in {"hann", "hamming"}:
raise ValueError(
"If a string is passed to `window`, it must be one of "
f'`"hann"`, `"hamming"`. Received: window={window}'
)
x = convert_to_tensor(x)
if center:View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/backend/jax/ops/math.py:167 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/7ea822325325f0dc.
Report an issue: GitHub.