jax-ml/jax · error · NotImplementedError
The 'out' argument to jnp.outer is not supported.
Error message
The 'out' argument to jnp.outer is not supported.
What it means
jnp.outer mirrors numpy.outer's signature including the out parameter, but JAX arrays are immutable so writing into a caller-provided buffer is impossible. Passing anything other than None for out raises NotImplementedError.
Solutions
- Drop the out argument and use the returned array
- If buffer reuse is needed, restructure to functional style (out = jnp.outer(a,b))
- Use block_until_ready / donation only at jit boundaries if memory reuse is the goal
Example fix
// before np.outer(a, b, out=buf) // after outer = jnp.outer(a, b)
Defensive patterns
Strategy: type-guard
Validate before calling
assert out is None, 'jnp.outer does not support out='
Prevention
- Strip out= kwargs when adapting numpy code to JAX
When it happens
Trigger: jnp.outer(a, b, out=result_array) with any non-None out value.
Common situations: Porting numpy code that used out= to reuse buffers; performance-tuning habits from numpy that do not apply in JAX.
Related errors
- out argument of
- array() got multiple values for argument
- array() takes at most 5 positional arguments but
- Because JAX arrays are immutable, jnp.ufunc.at() cannot…
- could not understand directive
AI-assisted analysis of jax-ml/jax@1e1c6a8fc0 (2026-08-27).
Data as JSON: /api/errors/b6cd7b891f1c5971.
Report an issue: GitHub.
Appendix: source
Thrown at jax/_src/numpy/tensor_contractions.py:682
Returns:
The outer product of the inputs ``a`` and ``b``. Returned array
will be of shape ``(a.size, b.size)``.
See also:
- :func:`jax.numpy.inner`: compute the inner product of two arrays.
- :func:`jax.numpy.einsum`: Einstein summation.
Examples:
>>> a = jnp.array([1, 2, 3])
>>> b = jnp.array([4, 5, 6])
>>> jnp.outer(a, b)
Array([[ 4, 5, 6],
[ 8, 10, 12],
[12, 15, 18]], dtype=int32)
"""
if out is not None:
raise NotImplementedError("The 'out' argument to jnp.outer is not supported.")
a, b = util.ensure_arraylike("outer", a, b)
a, b = util.promote_dtypes(a, b)
return a.ravel()[:, None] * b.ravel()[None, :]
View on GitHub (pinned to 1e1c6a8fc0)