keras-team/keras · error · TypeError

ldexp exponent must be an integer type. Received: x2 dtype={

Error message

ldexp exponent must be an integer type. Received: x2 dtype={x2.dtype}

What it means

Error "ldexp exponent must be an integer type. Received: x2 dtype={x2.dtype}" thrown in keras-team/keras.

Source

Thrown at keras/src/backend/numpy/numpy.py:877

    x2 = convert_to_tensor(x2)
    dtype = dtypes.result_type(x1.dtype, x2.dtype)
    return np.kron(x1, x2).astype(dtype)


def lcm(x1, x2):
    x1 = convert_to_tensor(x1)
    x2 = convert_to_tensor(x2)
    dtype = dtypes.result_type(x1.dtype, x2.dtype)
    return np.lcm(x1, x2).astype(dtype)


def ldexp(x1, x2):
    x1 = convert_to_tensor(x1)
    x2 = convert_to_tensor(x2)
    dtype = dtypes.result_type(x1.dtype, x2.dtype, float)

    if standardize_dtype(x2.dtype) not in dtypes.INT_TYPES:
        raise TypeError(
            f"ldexp exponent must be an integer type. "
            f"Received: x2 dtype={x2.dtype}"
        )
    return np.ldexp(x1, x2).astype(dtype)


def less(x1, x2):
    return np.less(x1, x2)


def less_equal(x1, x2):
    return np.less_equal(x1, x2)


def linspace(
    start, stop, num=50, endpoint=True, retstep=False, dtype=None, axis=0
):
    axis = standardize_axis_for_numpy(axis)

View on GitHub (pinned to 7a34a03db6)

When it happens

Trigger: Thrown at keras/src/backend/numpy/numpy.py:877 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/5fc3c0e674c6d304. Report an issue: GitHub.