keras-team/keras · error · NotImplementedError
JVP is not supported by the Numpy backend.
Error message
JVP is not supported by the Numpy backend.
What it means
The NumPy backend's `jvp` (Jacobian-vector product) is a stub: automatic differentiation requires a tracing/autodiff framework, and plain NumPy execution has none, so the function unconditionally raises NotImplementedError. This is a backend capability declaration — any jvp call on the NumPy backend fails, regardless of arguments.
Solutions
- Switch to the JAX or TensorFlow backend, which support forward-mode autodiff via keras.ops.jvp
- Implement the Jacobian-vector product manually by evaluating the function with dual numbers or finite differences on NumPy arrays
- Guard code paths that need jvp so they only run when backend() is 'jax' or 'tensorflow'
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at keras/src/backend/numpy/ops/linalg.py:122 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/0d4ef65ff13b1cbe.
Report an issue: GitHub.
Appendix: source
Thrown at keras/src/backend/numpy/ops/linalg.py:122
raise ValueError(
"Expected input to have rank >= 2. "
f"Received input with shape {x.shape}."
)
return np.linalg.matrix_rank(x, tol=tol).astype("int32")
def matrix_power(a, n):
a = convert_to_tensor(a)
return np.linalg.matrix_power(a, n)
def pinv(x, rcond=None):
x = convert_to_tensor(x)
return np.linalg.pinv(x, rcond=rcond)
def jvp(fun, primals, tangents, has_aux=False):
raise NotImplementedError("JVP is not supported by the Numpy backend.")
View on GitHub (pinned to 7a34a03db6)